How can an IDE script tell under which Xojo version it runs?

I mainly need my IDE script to tell whether it’s running in the 2013r3.3 IDE or in a later IDE, and it’s needed for a pre-build stage script.

Does someone know a way?

I’ve tried using XojoVersion directly in the script code, which just gives a compile error (meaning the IDE Script environment does not declare it). I’ve also tried getting it using ConstantValue(“XojoVersion”), but that fails, too (gives empty string).

It cant

I am hoping that someone knows a trick, e.g. something where the newer IDEs behave differently. I need to tell the 2013r3 apart from the 2016 IDE. Maybe something has changed about IDE scripting in the mean time that allows me to detect this difference.

Maybe call a function that’s not available in the older IDE, in a way that I can catch it and run a different code path.

Well, here’s a way that at least works on OS X - it uses AppleScript to ask for the app version of the frontmost app, which is usually the IDE (unless someone clicks it into the background during the build process, I guess):

[code] dim cmd, result as string
cmd = “osascript -e '”+EndOfLine+_
“tell application ““System Events”””+EndOfLine+_
“set p to path of (application file of first process whose frontmost is true)”+EndOfLine+_
“end tell”+EndOfLine+_
“return version of application p”+_
“’”
result = DoShellCommand (cmd)

print result[/code]

This returns “16.1.1.33502” for the 2016r1.1 IDE and “2013.3.3.0” for the 2013r3.3 IDE.

<https://xojo.com/issue/44418>

Don’t know if this might help, but you can get the internal version of the Xojo application on OS X like that from an IDE Script:

Dim IDEPath As String = DoShellCommand("echo ${IDE_PATH}") Dim command As String = "mdls -name kMDItemVersion """ + IDEPath.Replace(EndOfLine, "") + "/Xojo.app""" Dim version As String = DoShellCommand(command))
… will return something like that:

IDE Script itself has no built in way to tell

but the external measures you’ve mentioned can

they’re just not x-plat