Auto Increment Run Times?

Aside from “Auto Increment Version Info” which increases non-release version every time the app is built,
Is there any way to increase it everytime the app is run for testing inside Xojo IDE during development?

I want to track how many times I run a program from beginning of development to the finished stage.

[quote=164269:@Radium Radiovich]Aside from “Auto Increment Version Info” which increases non-release version every time the app is built,
Is there any way to increase it everytime the app is run for testing inside Xojo IDE during development?

I want to track how many times I run a program from beginning of development to the finished stage.[/quote]

You could update in your project code a small file containing a number each time the project is run.

Update a constant (or version Info if you like) with an ideScript, set it to run only in debug mode and to run before the build phase

Here’s an example of such an IDE Script:

If SelectProjectItem("App") Then // AppRunCount must already be a constant on the App object Dim value As String = ConstantValue("AppRunCount") Dim count As Integer = Val(value) count = count + 1 ConstantValue("AppRunCount") = Str(count) DoCommand("RunApp") End If

[quote=164341:@Paul Lefebvre]Here’s an example of such an IDE Script:

If SelectProjectItem("App") Then // AppRunCount must already be a constant on the App object Dim value As String = ConstantValue("AppRunCount") Dim count As Integer = Val(value) count = count + 1 ConstantValue("AppRunCount") = Str(count) DoCommand("RunApp") End If[/quote]
I don’t know anything about IDE Script yet, is it the same as XojoScript?
And where am I supposed to put your code for it to work?

It is similar to XojoScript, but has many other commands for controlling the IDE.

There is information about IDE Scriptiing in User Guide Book 3: Framework, Chapter 9: Building Your Applications, Section 3: IDE Scripting.

To create an IDE script, use File->IDE Scripts->New IDE Script

I also did an IDE script webinar about a year ago.

I inserted a public constant named AppRunCount under App as you said, as number
then entered the IDE script and entered RUN on the IDE Script editor window.
but AppRunCount is not getting increased by each run.

It seems to be working here using Xojo 2014r3.2. Has anyone else tried it?

  • Go Insert/Build Step/Script
  • Paste the code from Paul’s example
  • Comment out DoCommand("RunApp"). Since you will be running, it is not necessary.
  • Select the script and in the inspector, set behavior applies to debug
  • Drag the script to your computer build. Mac, Windows, or Linux

Now every time you run, it will increment the App.AppRunCount constant.

[quote=164451:@Michel Bujardet]- Go Insert/Build Step/Script

  • Paste the code from Paul’s example
  • Comment out DoCommand("RunApp"). Since you will be running, it is not necessary.
  • Select the script and in the inspector, set behavior applies to debug
  • Drag the script to your computer build. Mac, Windows, or Linux

Now every time you run, it will increment the App.AppRunCount constant.[/quote]
It is working.
Awesome!
Thank both of you.