[texworks] SCRIPTING: TW.app.applicationVersion

Paul A Norman paul.a.norman at gmail.com
Tue Jan 4 07:14:38 CET 2011


On 4 January 2011 05:28, Stefan Löffler <st.loeffler at gmail.com> wrote:
> Hi,
>
> On 2011-01-03 01:44, Paul A Norman wrote:
>> Continuing to work through the Scripting Api ...
>
> Great :).
>
>>          TW.information(null, "Name of Application",
>> TW.app.applicationVersion);
>>
>> Shows an empty box - as does the Debugger entry for it.
>>
>> Does any one know please is TW.app.applicationVersion  redundant or
>> just not wired up?
>
> It's not wired up, in a sense. This property is provided automatically
> by Qt (>= 4.4), but it's never set in the code.
> BTW: if you want the "Name of Application", you should use
> TW.app.applicationName, which indeed should be set.

Yes thank you I had that written up
http://twscript.paulanorman.com/docs/html/TexWorksQtScripting.htm?applicationName.html

> To get the version of Tw, you can use TW.app.getVersion(). The return
> value is in the form of 0xMMNNPP, with MM=major version, NN=minor
> version, PP=bugfix, so at the moment this would return . This is
> not human-readable (as applicationVersion should be), but much more
> useful in scripts for testing the current version.

I had that written up
http://twscript.paulanorman.com/docs/html/files/getVersion.html

In my example I had:

       TW.information(null, "Version of Application",TW.app.getVersion());

That returns a decimal 768 as anticipated (0x000300) i.e. 3 x 256

I'll add your notes from here to that later on.

I must admit that subconsciously with the current revision number (I
am on) being 726 I nearly confused the two.
Is there one for the revision number (I'm not suggesting it - just
checking if it exists).

There is another blank one TW.version;

When in Script writing we write

//Version: 0.3

Will the scripting engine be testing  for this and refusing to run the
script if the applications actual revision number is too low?
Could this provide an initial basis for testing for feature sets in
scripts perhaps?
In that the script writer would be nominating the lowest acceptable
version number needed to run the script - is that the intention of
//Version: 0.3 at all?

Or is that left to the script developer?

At the moment I can put //Version: 0.9 and it still runs ok. and if so
TW.app.getVersion() still reports 0x000300 so that is obviously as
expected reporting from the application and not the script header.

Paul

>
> HTH
> Stefan
>



More information about the texworks mailing list