Page 1 of 1

Can I add Compile/Build Count to version info automatically?

Posted: Fri Jul 30, 2010 9:05 pm
by benco5000
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.

Re: Can I add Compile/Build Count to version info automatica

Posted: Fri Jul 30, 2010 9:23 pm
by Arctic Fox
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 8)

Re: Can I add Compile/Build Count to version info automatica

Posted: Sat Jul 31, 2010 7:09 am
by Michael Vogel
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 :?

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

Re: Can I add Compile/Build Count to version info automatica

Posted: Mon Aug 23, 2010 10:11 am
by Michael Vogel
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:

Code: Select all

#VersionMain=3
#VersionSub=8
Global VersionText.s=Str(#VersionMain)+"."+Str(#VersionSub)+"."+Str(#PB_Editor_BuildCount)+"."+Str(#PB_Editor_CompileCount)
But how to get this into the version info?

Code: Select all

?????.?????.%BUILDCOUNT.%COMPILECOUNT

Re: Can I add Compile/Build Count to version info automatica

Posted: Mon Aug 23, 2010 12:02 pm
by cas
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

Posted: Mon Aug 23, 2010 1:17 pm
by blueznl
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?

Re: Can I add Compile/Build Count to version info automatica

Posted: Mon Aug 23, 2010 3:54 pm
by Michael Vogel
He would know, if I could tell him :lol:

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.