[texworks] Lua Extension - put into Sentance Case, Trim, Date Time, lowercase, uppercase

Paul A Norman paul.a.norman at gmail.com
Sun Sep 13 10:04:18 CEST 2009


Dear Jonathan,

Yes that QTscript is very JS like, and the extensions to the prototype model
are good to, and if I read the
http://doc.trolltech.com/4.0/designer-manual.html information correctly it
appears that QT forms can be invoked?

And it seems that there is built in script editing support in the
QTscripting framework for applications?

I guess I am just going to have to pick up whatever scripting environment
(QT Lua ...) is incorporated!
paul
2009/9/11 Jonathan Kew <jfkthame at googlemail.com>

> On 10 Sep 2009, at 11:53, Stefan Löffler wrote:
>
> I have no experience with this kind of Qt scripting, but a preliminary
>> search of the docs tells me "yes and no". If what Jonathan has in mind
>> is indeed QtScript, it is not JavaScript, it's _like_ JavaScript. It has
>> the same syntax and the same basic functions (e.g. for string handling,
>> calculations, etc.; technically speaking it implements the ECMA-262
>> standard), but it doesn't have all the browser/internet related
>> functions.
>>
>
> Right, the obvious thing to do in texworks is to enable QtScript, which (as
> I understand it) is an implementation of ECMAScript, which is the basis for
> JavaScript. But naturally this will not include many specifically
> web-browser-related objects and functions.
>
> I've been pleasantly surprised at how well it seems to work in general,
> though: for example, prompted by Paul's Lua examples, I googled for a JS
> Title Case function (as titlecasing is a non-trivial operation, if you want
> to do it well); found something promising at <
> http://individed.com/code/to-title-case/>, so I put that into a TW script,
> wondering if it would handle the tricky regexes, etc.... worked perfectly.
>
> No window, document,
>>
>
> Qt objects such as the document and window are scriptable, actually, though
> we may want to add setters for more properties: for example, AFAICT a script
> can read the window geometry (position, size) but cannot change it to
> arbitrary values, only call specific functions such as showMaximized (which
> works fine from script, I just tried). But we can trivially add things like
> move() and size() to allow a script more control (so you could write a
> custom window-arranging script, for example, to configure them to your
> liking).
>
> location and also no XMLHttpRequest
>> (which, IIRC, wasn't supported by many browsers for quite a while). So
>> much for the bad news.
>> The good news is that it could be relatively easy to work around this.
>> Qt does support HTTP requests, and it has additional classes to handle
>> XML. So one could fabricate something similar to XMLHttpRequest().
>> However, I'm not sure if this can be done from within the script (I
>> think it would have to be done on the C++ side and then made available
>> to the script; but these are details).
>>
>
> Right, I don't think there's any ready-made networking support, but I don't
> think it would be hard to add a scriptable object that can make requests and
> receive responses.
>
>
>> It just seems mind blowing what could be achieved. Tap directly into
>>> databases .., well do anything that the server that recives the
>>> request can process.
>>>
>>
>> Just one word of caution at the end. This mechanism can be incredibly
>> dangerous. If you execute scripts that you don't trust (and many people
>> seem to do this every day), you open the gates to viruses, hackers and
>> who knows what else. So I'd discourage automatic internet requests from
>> within scripts, and in any case the user has to be informed and has to
>> be able to choose whether or not a particular request should be made.
>>
>
> We'll need to label the package "Handle With Care". :)
>
> JK
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/texworks/attachments/20090913/d4bf31c8/attachment-0001.html>


More information about the texworks mailing list