Having problems with IDE scripting - App settings

According to the manual:
https://documentation.xojo.com/topics/build_automation/ide_scripting/project_commands.html
PropertyValue(propName As String, Assigns value As String)
Gets or sets the value of a project item property. This only works for properties of project items that are part of the Xojo framework (such as Window or App)
Properties of App that can be changed

MajorVersion
MinorVersion
BugVersion
StageCode
NonReleaseVersion
AutoIncrementVersionInformation
Version
Copyright

Be sure to use the “App.” prefix in front of any of these properties.

This is my script:

OpenFile "/Users/dirkcleenwerck/Documents/svnsource/rbproject/RBMain/RBMain.xojo_xml_project"
ConstantValue("ProjectFlags.VERSIEUPGRADE") = "24.02.0001"
Print "Wrote 24.02.0001 to ProjectFlags.VERSIEUPGRADE"
PropertyValue("App.MajorVersion") = "2402"
Print "Wrote 2402 to App.MajorVersion"
PropertyValue("App.MinorVersion") = "0001"
Print "Wrote 0001 to App.MinorVersion"
PropertyValue("App.BugVersion") = "1"
Print "Wrote 1 to App.BugVersion"
PropertyValue("App.Version") = "24.02.0001"
Print "Wrote 24.02.0001 to App.Version"
DoCommand("SaveFile")
Print "Project Saved"

It opens the project and changes the constant VERSIEUPGRADE to 24.02.0001
All the prints happen correctly and the project gets saved.

{“tag”:“build”,“response”:“Wrote 24.02.0001 to ProjectFlags.VERSIEUPGRADE”}{“tag”:“build”,“response”:“Wrote 2402 to App.MajorVersion”}
{“tag”:“build”,“response”:“Wrote 0001 to App.MinorVersion”
{“tag”:“build”,“response”:“Wrote 1 to App.BugVersion”}
{“tag”:“build”,“response”:“Wrote 24.02.0001 to App.Version”}
{“tag”:“build”,“response”:“Project Saved”}

Unfortunately, none of the App properties have changed.
Working with Xojo r2023r3 on MacOS Ventura 13.6.3
Any idea what could be going wrong?

Does:

DoCommand(“save”)

After it works? As i’ve thought it was “save” instead of “saveproject” or “savefile”

This isn’t new. I’m also using “echo home” to set the user like this:

dim theCommand, theResult as string
dim userHome as String = DoShellCommand("echo $HOME")
userHome = Trim(ShellEncode(userHome))
dim basePath as string = userHome + "/Documents/Development/Mail\ Archiver/"

From the manual at https://documentation.xojo.com/topics/build_automation/ide_scripting/docommand.html

Commands used by DoCommand

The following commands may be used as parameters to the DoCommand method.

Project navigation and management

  • OpenFile: Displays the Open Project File dialog.
  • SaveFile: Saves the current project with no prompt.
  • SaveFileAs: Displays the File Save As dialog.

So I used to SaveFile

1 Like

It sounds like the manifest file isn’t being dirtied when those changes happen. You can check this by running your script in 2021r1 and see if it works. Either way, file a bug report.

The reason for the test is that a change was made in summer 2021 that tied project dirtying to the undo system to try to make text project saves only save the things you actually touched. It works, but “what the user touched” is not always black and white.

Unfortunately running the script in 2021r1 didn’t work either.
I don’t know how much use filing a bug report is in this case because it only happens in the project of our main product and unfortunately I’m not allowed to share that one.
Our other projects do not suffer from the problem, so I can’t make it reproducible.

You didn’t have another project open when you ran the script did you?

No, I made sure to close everything down before doing the test.
The script does work, because it changes the constant VERSIEUPGRADE and it saves the project at the end.
The only thing that does not work is changing properties of the app, and then only on this project, because when we try the same script with other xojo projects, it works just fine.

Is the App item moved to a folder?

No, the app element is in the root of the project

These are the app elements under ‘Build Settings - Shared’

I expect them to be like this after the script has run

Unfortunately they don’t change.

In the mean time my constant in the module ProjectFlags did get changed
image

So it’s only the app properties that don’t get changed for some reason (and like I mentioned only in this project)

You could try using constants for all of these values.

1 Like

That’ll work for now.
Thanks for trying to help.

1 Like