Weird behaviour when compiling current application's version

I have an applet which, when an error is encountered, will give the user the option to email me about the error. The email automatically includes the version of the applet that encountered the error. Or at least it would, except for this weird behaviour.

When I compile current application’s version in SD it simply becomes version (i.e. “current application’s” disappears). Nevertheless, if the script is then run it will work as expected. But if I make some changes/additions to the script and compile it again, version just seems to become a string or something.

Steps to reproduce:

  1. copy and paste the below code into a new SD document (it doesn’t seem to matter whether it’s a script or an applet)
  2. compile (current application’s version will become version)
  3. run (script behaves as expected, in my case the alert text is “7.0.6”)
  4. make any addition to the script (e.g. add message “See what I mean?” to the display alert command)
  5. compile and run (alert text will be “version”)
  6. if you add current application’s before version, compile and run again the behaviour will be as point 3 above

use AppleScript version “2.4” – Yosemite (10.10) or later

use scripting additions

display alert ((current application’s version) as text)

You shouldn’t be using current application's version — use my version instead.

1 Like