Using Date in IDE script

Xojo 2021r1.1 - Windows 10 desktop

Is it possible to use a Date variable in an IDE script ?

Since a few years I am using a IDE script for building my app’s in Windows.
It use the ‘Major Version’, Minor Version’ and ‘Bug Version’ properties of my app to build with a suited name. (for example ‘app v21r1’ or ‘app.v21r1 beta 2’)
With Advanced Installer I create the msi install file that users can download and install…
This works perfect.

But I was thinking of naming my pre-releases in another way (a bit like Xojo does).
I would like the name to be ‘app v21r1 build 1018’ and 1018 means Month/Day of creation (in this case Octobre 18)
The pre release will then be a zip file with all the needed files to start the app.

Is it possible to create this date in an IDE script automatically ?

I found a way to use a Constant Value in the IDE but I will always need to set it in the code before starting the build script.
As a Constant can not be changed in code it will be necessary to change this Constant each time before running the Build script.

Is it possible directly in the script ?
Can I use a variable from my app into the script ?

Thanks
Regards

You can’t use Date (or DateTime) in IDE Scripts or XojoScript because they only support the intrinsic types by default. Anything that is an object simply does not exist.

You can usually deal with this with a call to DoShellCommand to get the date from a command line call.

On Windows, use

date /t

@Greg O’Lone,
Thank you very much for the tip about the DoShellCommand.
My script works perfect now in Windows.
This is the code in my script

Var InitialAppName As String = PropertyValue("App.WindowsAppName")
Var AskVersionOK As String
Var MajorVersionNr As Integer = Val(PropertyValue("App.MajorVersion"))
Var MinorVersionNr As Integer = Val(PropertyValue("App.MinorVersion"))
Var PreReleaseVersion As String
Var result As String
Var build As String

result = DoShellCommand("date/t") 
'# First the Month followed by the Day
build = result.NthField("/", 2) + result.NthField("/", 1).Right(2)

PreReleaseVersion = Str(MajorVersionNr) + "r" + Str(MinorVersionNr) + " " + "build " + build
AskVersionOK = ShowDialog("A Pre-release version will be build" + EndOfLine + "    " + InitialAppName + " v" + PreReleaseVersion, "       Do you want to proceed ?", "YES", "NO", "", 3)
Select Case AskVersionOK
Case "YES"
  PropertyValue("App.WindowsAppName") = InitialAppName + " v" + PreReleaseVersion
  Call BuildApp(3)
  '# Sets back the Initial App Name to the Windows Build Settings
  PropertyValue("App.WindowsAppName") = InitialAppName
Case "NO"
  '# Nothing is done
End Select

Beep