Wednesday, December 7, 2022

Announcement will transition to a new Discourse server soon. Watch this space for the date and time of the transition. Please expect the site to experience periods of outage during this transition. See this and this for more details.

#1 2009-03-25 07:48:49 am

Nigel Garvey
From:: Warwickshire, England
Registered: 2002-11-20
Posts: 5589

Script Editor 2.0: opening scripts that end with a one-line 'if'

Script Editor 2.0 won't open a compiled script file on the first attempt if the last line of the script is a one-line 'if' statement and one or more of the following is true:

The 'if' condition is an expression rather than a direct boolean value, or:
The conditionally executed code contains another 'if' statement, or:
The conditionally executed code contains an application specifier.

The file opens on the second attempt, but the resulting Script Editor window has the name "Window" instead of the name of the file.

If the text of such a script has not yet been compiled, or has not yet been recompiled after an edit, running it in Script Editor 2.0 (if that's something you're likely to do) only effects the compilation. A second Run is needed to run it.

Work-rounds include:

Rewriting the last line of the script as a multi-line statement.
Splitting the line with a continuation character.
Putting a comment line or more than one blank line after the last line.

This bug is only known to affect Script Editor 2.0 and its sub-versions and has existed since the days of Jaguar.

Thanks to Sean Zhu for noticing the problem and raising it in the OS X forum.

Last edited by Nigel Garvey (2009-03-26 03:08:59 pm)




Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)