[texworks] SCRIPTING: TW.app.applicationVersion

Stefan Löffler st.loeffler at gmail.com
Tue Jan 4 07:31:39 CET 2011


Hi,

On 2011-01-04 07:14, Paul A Norman wrote:
> 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).

No, right now the revision is not available, AFAIK. Note, though, that
is shouldn't be too important for most "normal" operation, meaning that
the scripting capabilities will depend primarily on the stable release.
For development, things will depend on the revision, of course, but
people who use development versions and scripts should probably be adept
enough to check that.

> There is another blank one TW.version;

Odd, I don't see this.

> 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?

No, but this is a common misunderstanding (that I've fallen victim to
myself in the past ;)).
The version header is just for informational purposes, and marks the
version of the script. I.e., whenever you make significant changes to
your script, you probably want to increase the version as well. This is
to keep track of major changes, and enables the user to quickly check if
a newer version of a particular script is available. This string is only
displayed in the script manager, apart from that it currently has no
function. In particular, it is *not* the Tw version required to run the
script.

> Or is that left to the script developer?

Yes, checking the capabilities is left to the script author. Especially
since in some cases, this may depend in a complex way on a combination
of Tw version, Qt version, and OS.

> 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.

Yeah. As I wrote above, this is the version of the script, not of Tw
(otherwise we would probably have called it something like
"RequiredTwVersion" or "MinimalTwVersion").

HTH
Stefan


More information about the texworks mailing list