[texworks] Updating Scripting Api...

Stefan Löffler st.loeffler at gmail.com
Sat Jul 23 08:41:34 CEST 2011


On 2011-07-23 08:07, Paul A Norman wrote:
> TW.app.doResourcesDialog();
> Very useful.
> Does this have a corresponding button or Menu Item or anything in the
> TeXworks interface itself?

Yes, of course. It's "Help > Settings and Resources...".

> ---------
> TW.app.newFile();
> If User set  write permissions are on, could this please be made to
> return a document object to Script?
> e,g,
>  	     var     newTarget =    TW.app.newFile();
>  	          newTarget.insertText("hi");

Done in r866. No need for write permission, really, as this is only
created in memory (i.e., it's not saved) and can't overwrite any
existing data.

> --------
> This can be set in Script, and when the last window is closed  Tw
> remains as a process with no Application interface.
>           TW.app.quitOnLastWindowClosed = false;
> I am trying to work out what it is for?

This is another property provided automatically by Qt and should not be
changed by scripts (it falls under the "Don't use" category ;)). It is
documented at
(not sure if this helps, though).
Basically, as you wrote, it allows a program to remain running after the
last window has been closed. This might be useful to write some kind of
daemon/service that runs in the background automatically (though I'm not
sure if this is the intended purpose), or if there is some other way to
close the application. For example, on the Mac applications live on even
without windows with a global menu bar (and in the Finder or whatever
the taskbar-like thing is called). This (Mac) is also the only case this
property is currently used in Tw.


More information about the texworks mailing list