[texworks] Script: Questions about the API

Paul A Norman paul.a.norman at gmail.com
Thu Apr 15 03:41:00 CEST 2010


Dear Stefan,

> 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!)

Paul

On 15 April 2010 05:14, Stefan Löffler <st.loeffler at gmail.com> wrote:
> Hi,
>
> Am 2010-04-13 10:40, schrieb Paul A Norman:
>>>>    6. a) Can I obtain the directory of the executable?
>>>>        b) Can I obtain the scripts directory?
>>>>
>>>>
>>> No. The directory of the executable may be the current directory, though
>>> even that is not guaranteed on all platforms. What do you need this for?
>>>
>>>
>> relocating things stored under there - e.g. help info - you know my
>> fixation for doing help file stuff :)   I had noticed that TeXWorks
>> obviously knows where the Script folder is.
>>
>
> Yeah, I know your dedication to help files - it's great :).
> Regarding relocating stuff, I'm not sure if this is a good idea.
> Especially packaged versions of Tw (as they come with *TeX distros, but
> also e.g. for Ubuntu) usually have their own particular layout of where
> which files go. I think this is quite unpredictable for a script,
> especially if it's supposed to run on all systems. So it should be
> possible to expose some functions to obtains these directories, but at
> the moment I am a bit reluctant to do that.
>
>>>> Jonathan, did you mention a while ago that QT could display an html
>>>> browser window?
>>>>
>>>> If so can QTScript call this and communicate with it through the
>>>> browser's object's DOM?
>>>>
>>>> Then we could design user interaction windows and use them from script.
>>>>
>>>>
>>> AFAIK, Qt can in principal display HTML (e.g. inside a label, text edit,
>>> etc.). This is currently not exposed to the scripts. However, I don't
>>> think it would be of much use as there is no easy way to communicate
>>> with the html objects. So you could design a nice interface, but you
>>> wouldn't get any of the user's input. But I'll have to look into this a
>>> little more, maybe there is a way.
>>>
>>>
>> I had some idea there was some sort of Qt  HTML module mentioned once
>> - but I know absolutely nothing about it - found this on a search
>> today http://doc.trolltech.com/4.4/qtwebkit.html
>>
>
> Hmmm, this sounds very interesting indeed. The only problem is that it
> wasn't available in Qt 4.3, which we're also trying to support. But I'll
> definitely have to look into this.
>
>>
>>>> do we have any access to the clipboard in QTScript?
>>>>
>>>>
>>> No, sorry. Are you interested in copy & paste (text?), or in
>>> manipulating the available content of the clipboard?
>>>
>> Obtaining plain text,
>> and setting plain text for user pasting.
>>
>
> 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
>



More information about the texworks mailing list