[texworks] Scripting root file behaviour

Thomas Fehige thomas at fehige.de
Sat Apr 14 11:18:19 CEST 2012


Thanks for the input. What I have now as a skeleton is this:
//---------------------------------------------------

if (TW.app.hasGlobal("main_file")){

TW.app.getGlobal("main_file") // that's where the /path/and/filename.tex 
are stored by another script

var windows = TW.app.getOpenWindows();

for (Win in windows){

                 // here I'd want to see if the main_file is open in an 
editor window,

// if necessary, load it and finally call its target.typeset() function.

// But I don't get the filenames of the editor windows but empty 
information messages instead:

TW.information(null, "File in Window:", Win.fileName);

         }

} else {

// typeset the file in the current window
}

//---------------------------------------------------

It seems I've missed something, but what?

Thanks and all the best -- Thomas

Am 13.04.2012 14:04, schrieb Stefan Löffler:
> Hi,
>
> On 2012-04-10 20:18, Henrik Skov Midtiby wrote:
>> I think you can activate the compilation of the current document with
>>
>> TW.target.typeset();
>>
>> Something similar should be available for all the open documents [1]
>>
>> TW.app.getOpenWindows()
>>
>> The idea is to get the window of the main document and trigger the
>> compilation from there.
>> There might be a better solution somewhere, but I have no knowledge of it (yet).
> I think this is a fairly good solution (actually, that's basically what
> Tw does internally).
>
> Cheers,
> Stefan



More information about the texworks mailing list