Create a constant at build time

Hello All,

Is it possible at build time to have a value, such as the date or current version number, be set in a constant that at run time can be referenced.

That value will then be used to distinguish between data created with differing versions of the application.

Regards Mark

Not sure if I understand you question correctly but you can access most things that were set in the Build settings.
For example: App.ExecutableFile.Name, App.MajorVersion, App.MinorVersion, App.BugVersion etc.
But also App.BuildDate

For example, this is what I normally put in my Window.Open events. If not a production build, it should expire 2 weeks after the build.

  // Dev, Alpha and Beta's Expire 14 days after Build
  #If Not DebugBuild Then
    If App.StageCode <= 2 Then
      Dim dExpire As New Date
      dExpire.Day = App.BuildDate.Day + 14
      
      Dim dNow As New Date
      If dNow >= dExpire Then
         MsgBox("Sorry, this version is expired.")
        Quit
      End If
      
    End If
  #EndIf

You can set constant values in a build script.

Thanks Both,

Marco that may be what I want, I will do a test and see how it goes.

Tim, I have looked at build scripts and read that there was a sample of such a constant script in the examples folder, but it does not exist or indeed any of them that I could find!

This is what it said in the Xojo Documentation PDF:-

Example Scripts
There are several example IDE Scripts included with Xojo. Look in the Examples/Advanced/IDE Scripting folder. Some examples include:
? AddCommentHeader
? BuildAllDesktop
? CountDebugRuns
? CreateConstant
? EncryptItems
? Reload Project
? SaveAll
? SetShortVersion

I suppose what I actually want is the create constant script.

The constants are already available. There is no need to create a new one.

Thanks for the replies, I now understand that Marco provided the answer I was looking for.