[texworks] Scripts: Exploration of TW objects

Stefan Löffler st.loeffler at gmail.com
Thu Nov 4 20:53:00 CET 2010


Am 2010-11-04 10:52, schrieb Paul A Norman:
> Put this (the below) as a script, I called it tw_OBJECTS.js in a script folder.

this is very interesting, I didn't realize this. Thanks for sharing (it
was the missing piece to get the poppler page number - see separate thread).

> Does the result suggest that all the found children can in some way be
> slotted into and even **safely** called by QtScript?

If by "slot into" you refer to the signal/slot mechanism of Qt, the
answer is pretty definitely no.
Calling the objects' methods and/or accessing their properties shouldn't
be a problem, though.

A important thing to emphasize however: the output (i.e., the accessible
objects) will depend on the context (TeXDocument vs. PDFDocument) the
script is run in, in general (particular as far as ui items are concerned).


> //TeXworksScript
> //Title:  Experimental TW
> //Description: Exploration of TW objects
> //Author:  Paul A. Norman
> //Version: 0.3
> //Date:  2010-11-04
> //Script-Type: standalone
> //Context: TeXDocument
> //Shortcut: Alt+T, Alt+W
> // TW.information(null, "", TW.app.findChildren());
>   study = TW.target.findChildren() +'';
>   study = study.replace(/,/g,",\n")
> TW.target.insertText(study);
>  null;
> //========== Results ===========

More information about the texworks mailing list