So I have a function that is updating some XML and I would like to pass the {AppVersion}
that has been set in the [Setup]
part of the script as a constant to this function
I have tried
MyFunction(ExpandConstants({AppVersion})
But this gives me an error? How do I pass this constant to my function correctly
My Code
[Files]
Source: ".\Source\myfile.txt"; DestDir: "{app}\System"; AfterInstall: MyFunction('{#SetupSetting("AppVersion")}')
[Setup]
AppId=MyApp
AppName=My Application
AppVersion=011
DefaultDirName=C:\MyApp
[Code]
procedure MyFunction(Text: String);
begin
MsgBox(Text, mbInformation, MB_OK);
end;
Use the SetupSetting
preprocessor function for expanding [Setup]
section directive values:
MyFunction('{#SetupSetting("AppVersion")}');
A short proof:
[Setup]
AppName=My Program
AppVersion=1.2.3.4
DefaultDirName={pf}\My Program
[Code]
procedure InitializeWizard;
begin
MsgBox('AppVersion is: {#SetupSetting("AppVersion")}.', mbInformation, MB_OK);
end;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With