[texworks] Script: Questions about the API

Stefan Löffler st.loeffler at gmail.com
Wed Apr 14 19:14:22 CEST 2010


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
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 ;).


More information about the texworks mailing list