[texworks] Script: Questions about the API

Stefan Löffler st.loeffler at gmail.com
Thu Apr 15 09:43:48 CEST 2010


Hi Paul,

Am 2010-04-15 03:41, schrieb Paul A Norman:
>> Obtaining the clipboard text should be OK - I added it to the list
>> (http://code.google.com/p/texworks/issues/detail?id=333).
>> Setting/overriding the content of the clipboard is more problematic,
>> though. At least I expect the clipboard to contain what I last
>> copied/cut. I think I would be very confused if I hit paste and got some
>> text I never copied. But of course this is my personal opinion, so
>> everyone is welcome to (try to) convince me otherwise ;).
>>
>> -Stefan
>>     
> What I am looking at is copying material from other sources, it often
> has to be pre-processed (exotic: quote marks, line breaks ... things
> converted to LaTeX: \P and so on etc...)
>
> Sometimes I  have it on the clipboard, but have not yet positioned the
> cursor in the right place in Tw yet.  So as we don;t have QTScript
> object persistance,  I want to run the script which will process the
> clipboard content back to the clipboard, then paste it in when ready.
>
> Its then also ready (in prepared form) to be pasted elsewhere in Tw
> and if its immediately needed in other files, or into a new file as
> LaTeX if I want it as a snippet kept for posterity in it's own file
> for later reuse. I realise there will be other practical (but
> involving more steps) ways of achieving the same thing
>
>          .. but there you are, that's my medium strength case for this :)
>
> (Though it still does intuitively seem useful to be able to write back
> to the clipboard!)
>   

OK, point taken. Converting material that is "parked" on the clipboard
into a suitable *TeX format is certainly something very interesting for
many people.
I still don't know if writing to the clipboard is 100% necessary (just
for inserting, you could use TW.target.insertText()), but I guess if
used carefully it may be helpful.

I've posted a patch for this on GC
(http://code.google.com/p/texworks/issues/detail?id=333#c1), but of
course Jonathan has the last say in whether he commits this or not.

HTH,
Stefan


More information about the texworks mailing list