Xojo Build Automation Scripting

All I’ve really done with Build Automation is the copy files function, but now I have something else I’d like to automate, not sure if it’s possible.

One app I’ve made is customized for every client. One of the things I use is a string constant (let’s call it kUser) which is unique to each build.

Can I add a Build automation that could prompt me for the value of kUser each time I build?

As a prebuild script
there used to be an example of such a thing

See if Examples > Advanced > Build Automation > AutoSaveScript doesnt work or lead you in the right direction

1 Like

I followed a different way to achieve nearly the same purpose:

In a special Prefs folder, I have some images (logos at different size / orientation, that fits the application needs), some texts (Company Name / Address / etc.).

The idea was to … at (first) launch time, the installer person choose the correct data (images/texts), then these will be used all the time until someone provide a new set / change the prefs.

This also allowed me to make some pressure on the client. Unfortunately, the contract failed. (I presented them that feature, with an Acme logo/fictional address by default, then I changed to the blue [French] logo of the company and to the red [German] logo of the company: “This software can be customized…”)

The application name stayed (I think, but not sure) the same.

I see how to create a script, but I’m not clear on what script command would set a constant value in the main code. Or are you saying that the script has the ability to modify values in the code?

The example doesn’t show anything in the script other than DoCommand "SaveFile". The other examples are IDE_Communicator which don’t seem to be helpful either.

Can you point me towards some scripting documentation I can use for changing values within my code?

Ok, digging in a little further, it seems that the DoCommand can maybe do this. The DoCommand can have a value of
NewConstant: Adds a new constant to the selected project item.

Just have to figure out:

  1. Is there an EditConstant to change the value of a constant
  2. How to select the correct constant
  3. How to prompt for a value on build


ConstantValue(name As String) As String
Gets or sets the value of a project item constant.

Sample Code
Change the value of an existing constant on App:

If SelectProjectItem("App") Then
  // kBeta must already exist
  ConstantValue("kBeta") = "True"
End If

You can also refer to the full constant name like this:

// kBeta must already exist
ConstantValue("App.kBeta") = "True"

I’ll give this a try…

Ok, that works, but can’t figure out how to do a prompt for the value.

Got it.

ConstantValue("MainWindow.kUser") = Input("Enter the User:")

BTW, this is probably one of the coolest things I’ve seen recently that the IDE can do!