kiplingw
28th February 2005 21:42 UTC
Create installer version at runtime
Greetings everyone,
I would like to set my installer's version information at compile time based on the version number of another executable. GetDllVersionLocal unfortunately can only be called inside a function at runtime. I would like to do this without creating a seperate script to invoke the main one. Is this possible? Thank you.
--
Kip
Afrow UK
1st March 2005 08:09 UTC
You need to compile this:
OutFile "GetVersion.exe"
!define File "C:\MyFile.exe"
Function .onInit
GetDllVersion "${File}" $R0 $R1
IntOp $R2 $R0 / 0x00010000
IntOp $R3 $R0 & 0x0000FFFF
IntOp $R4 $R1 / 0x00010000
IntOp $R5 $R1 & 0x0000FFFF
StrCpy $R1 "$R2.$R3.$R4.$R5"
FileOpen $R0 "$EXEDIR\Version.txt" w
FileWrite $R0 '!echo "${File} version: $R1"$\r$\n!define Version "$R1"'
FileClose $R0
Abort
FunctionEnd
Section
SectionEnd
Make sure you change the path of C:\MyFile.exe to your EXE's path.
Put the output installer in the same place as your script, then put this at the top of your script:
!system "GetVersion.exe"
!include "Version.txt"
You will then have the ${Version} define available.
-Stu
WhiteLion
16th June 2005 17:08 UTC
There is another solution I came to...