Getting project type with IDE Scripting

I am writing an app that uses IDE communicator to automate some stuff and it would be helpful if it could tell what the project type (desktop, web, etc) is. I see the CurrentBuildTargetIs* commands, but that is restricted to build steps, right?

I suppose I could check a project for a Session object since that would be web-only, and I would think there is something similar for an iOS or Android project.

If you prefix with # then the code is not included outside of the debugger. But if you don’t use the # command, you can do whatever you want ie

#If TargetMacOS Then
  'only runs in macOS
  MessageBox "Mac only"
#EndIf

If TargetMacOS Or TargetWindows Then
  'runs in macOS or Windows
  MessageBox "Mac and Windows only"
  
  #If TargetMacOS Then
    'do something for macOS only
  #ElseIf TargetWindows Then
    'do something for Windows only
  #EndIf
End If

well, that’s close. But it doesn’t distinguish project type, just the target platform.

This is the full list.

Aren’t things like TargetDesktop, TargetConsole, and TargetWeb what you are looking for?

Yes, do those work in an IDE script?

Ahh yeah, you’re right. Those don’t work in an IDE script.

You can set up constants and variables in a Script to do this:

'Const kOSX32 = 7
Const kMacOSARM64 = 24
Const kMacOSIntel64 = 16
Const kMacOSUniversal64 = 9

Const kWindowsARM64 = 25
Const kWindowsIntel32 = 3
Const kWindowsIntel64 = 19

Const kLinuxARM32 = 18 'Raspberry Pi 32-bit
Const kLinuxARM64 = 26
Const kLinunIntel32 = 4
Const kLinuxIntel64 = 17

Const kiOSDeviceARM64 = 14
Const kiOSSimulatorARM64 = 10
Const kiOSSimulatorIntel64 = 13

Const kAndroidDeviceARM64 = 23
Const kAndroidEmulatorUniversal64 = 21

Const kXojoCloudIntel64 = 12

Var isCompileDesktop As Boolean = True
Var isCompileWeb As Boolean = True
Var isCompileMobile As Boolean = True

If isCompileDesktop then
Var Path As String = BuildApp(kMacOSIntel64, False)
ElseIf isCompileWeb then
…
ElseIf isCompileMobile then
…
End If