IDE scripting is really aimed at automating tasks that you might do manually.
There are things it simply can’t do nor was it ever designed to do.
You can’t create constants, nor can you create the individual instances for each language / platform for a dynamic constant.
There’s actually a list if you search in feedback for “ide script”
You can actually create constants via scripting. You can’t (that I know of) change the declaration of one though, which would be nice. For example, you can create a new property and then change its declaration:
If SelectProjectItem("App") Then
DoCommand "NewProperty"
ChangeDeclaration("AbcXyz", "HELLO", "String", 2, "")
End If
That same code on a constant, though, will err:
If SelectProjectItem("App") Then
DoCommand "NewConstant"
ChangeDeclaration("AbcXyz", "HELLO", "String", 2, "")
End If
The above code will create a new constant, but it remains “Untitled” and the script errs when it comes to the ChangeDeclaration call.
It’d also be nice to be able to write to the IDE Log screen from a script, such as System.DebugLog "john doe" does (<https://xojo.com/issue/27378>)
Right - you can create a constant but not the constant you want so it’s pretty useless as is unless you want everything to be the same types & just named untitled, untitled1, untitled2, etc