[texworks] Script: Questions about the API

Paul A Norman paul.a.norman at gmail.com
Tue Apr 13 10:40:42 CEST 2010


Many thanks Stefan I know that you guys are very busy, so your reply
is really appreciated.

On 13 April 2010 18:06, Stefan Löffler <st.loeffler at gmail.com> wrote:
> Hi Paul,

>
>>    3. Can QTScript save text to a file on disk?
>...
> There is no
> direct way, though, and I'm not sure there will be one in the near
> future. If you can write arbitrary data to arbitrary positions on the
> disk, this can be pretty serious security vulnerability.

Absolutely see the point.  Got to think like a bad dude sometimes :)

>>    5. Can a file dialog box be used and the result returned as a
>> string to script?
>>
>
> Isn't this possible with TW.app.getOpenFileName() /
> TW.app.getOpenFileNames()?

Thanks I was not following that through originally and had assumed
they() directly opened the files. Though I later did discover this was
not so.

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

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

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

>
> HTH
> Stefan
>

Again thank you very much for writing back - much appreciated it does
help a lot.

Paul



More information about the texworks mailing list