Is there a way to auto populate compiler -> options -> Version Info -> File Version / Product Version
with the count of builds / compiles or both?
Example you build/compile a project 2729 times.
Could we put 2729 into Version (like a build number) auto-magically?
and also
Could we put that number into the title of the main window?
TIA.
Can I add Compile/Build Count to version info automatically?
- Arctic Fox
- Enthusiast
- Posts: 609
- Joined: Sun Dec 21, 2008 5:02 pm
- Location: Aarhus, Denmark
Re: Can I add Compile/Build Count to version info automatica
For Version Info - use the tokens %COMPILECOUNT and %BUILDCOUNT.
For the main application - use the constants #PB_Editor_CompileCount and #PB_Editor_BuildCount.
Edit
Remember to activate #PB_Editor_CompileCount and #PB_Editor_BuildCount in Compiler Options > Constants
For the main application - use the constants #PB_Editor_CompileCount and #PB_Editor_BuildCount.
Edit
Remember to activate #PB_Editor_CompileCount and #PB_Editor_BuildCount in Compiler Options > Constants

- Michael Vogel
- Addict
- Posts: 2797
- Joined: Thu Feb 09, 2006 11:27 pm
- Contact:
Re: Can I add Compile/Build Count to version info automatica
Cool, didn't know that
The only bad thing is, that for normal I create a string constant (#Version) for the version string, this has to be changed now totally

The only bad thing is, that for normal I create a string constant (#Version) for the version string, this has to be changed now totally

Code: Select all
#Version1="Version 7.5."; original code
#Version1="Version 7.5."+#PB_Editor_BuildCount+"."+#PB_Editor_CompileCount; would be fine, if this works...
#Version1="Version 7.5."+Str(#PB_Editor_BuildCount)+"."+Str(#PB_Editor_CompileCount ); ...or this...
#Version1="Version 7.5."+{Str}#PB_Editor_BuildCount+"."+{Str}#PB_Editor_CompileCount ; ...or this
CompilerIf #PB_Compiler_Version<440
#Version2=#Version1+"0 "
CompilerIf Subsystem("DirectX9")=#False
#Version3=#Version2+""; DX7
CompilerElse
#Version3=#Version2+"Aero"; DX9
CompilerEndIf
CompilerElse
#Version2=#Version1+"o "
CompilerIf Subsystem("DirectX7")=#False
#Version3=#Version2+"Aero"; DX9
CompilerElse
#Version3=#Version2+""; DX7
CompilerEndIf
CompilerEndIf
#Version=#Version3
- Michael Vogel
- Addict
- Posts: 2797
- Joined: Thu Feb 09, 2006 11:27 pm
- Contact:
Re: Can I add Compile/Build Count to version info automatica
Does anyone know, how to use constants in the program and the version info?
Lets say my program actually has a version 3.8 and I use the build and compile counter to get something like 3.8.1.333 in the version info.
In the program itself, the string can be done by something like that:
But how to get this into the version info?
Lets say my program actually has a version 3.8 and I use the build and compile counter to get something like 3.8.1.333 in the version info.
In the program itself, the string can be done by something like that:
Code: Select all
#VersionMain=3
#VersionSub=8
Global VersionText.s=Str(#VersionMain)+"."+Str(#VersionSub)+"."+Str(#PB_Editor_BuildCount)+"."+Str(#PB_Editor_CompileCount)
Code: Select all
?????.?????.%BUILDCOUNT.%COMPILECOUNT
Re: Can I add Compile/Build Count to version info automatica
Sadly, you need to write it manually into version information field:
Code: Select all
3,8,#PB_Editor_BuildCount,#PB_Editor_CompileCount
Re: Can I add Compile/Build Count to version info automatica
Yeah, that's what I do. I use this approach:
1. a 'save' number (it's what CodeCaddy generates every time I run / compile a program)
2. a 'build' number (as above, a build counter)
3. a 'version' number (which I maintain by hand)
When I work on some code I just keep hacking
at it, under the same version number, until I'm happy with it (or have given up
)... I'll then build it, and increase the version number in the source for the next session... This ends up with version names like:
version 1.41 build 227 save 7718
or, if you like a dotted format:
141.227.7718
So it's version number by hand, but think about it, how should the compiler know what version you're working on?
1. a 'save' number (it's what CodeCaddy generates every time I run / compile a program)
2. a 'build' number (as above, a build counter)
3. a 'version' number (which I maintain by hand)
When I work on some code I just keep hacking


version 1.41 build 227 save 7718
or, if you like a dotted format:
141.227.7718
So it's version number by hand, but think about it, how should the compiler know what version you're working on?
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
( The path to enlightenment and the PureBasic Survival Guide right here... )
- Michael Vogel
- Addict
- Posts: 2797
- Joined: Thu Feb 09, 2006 11:27 pm
- Contact:
Re: Can I add Compile/Build Count to version info automatica
He would know, if I could tell him
Just thought, it would be fine to enter these things only one time, like #VersionMain=3 in the code (or the compiler settings) and something like %CONSTANT_VERSIONMAIN in the compiler configuration dialog would use the assigned value.

Just thought, it would be fine to enter these things only one time, like #VersionMain=3 in the code (or the compiler settings) and something like %CONSTANT_VERSIONMAIN in the compiler configuration dialog would use the assigned value.