XojoScript to auto-update build version based on current date

The script has to be placed before Build, not after.

Var result As String
result = DoShellCommand("date /t")  ' I compile on windows os and it gives me 05.04.2022

PropertyValue("App.MajorVersion") = result.NthField(".", 3) ' year
PropertyValue("App.MinorVersion") = result.NthField(".", 2) ' month
PropertyValue("App.BugVersion") = result.NthField(".", 1) ' day

Now, depending where in the world you are located, the date might be formatted different from mine. Experiment with the nthfields above to get what you need.

3 Likes

Great idea :smiley:

Just take note that the /t could be disable on some instances. but you can also use the system variable %date%:

echo %date%

1 Like