2

I have a script that reads the version number from an application file. Now I need to find a way to place this number in the AppVersion directive of Inno Setup.

How can I place the return value of my function in the AppVersion directive?

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
JimmyD
  • 2,629
  • 4
  • 29
  • 58

1 Answers1

2

Use a scripted constant:

[Setup]
AppVersion={code:GetAppVersion}
[Code]

function GetAppVersion(Param: string): string;
begin
  Result := MyFunction;
end;

If the function call is costly, you should cache its value to a global variable and use the cached value in the scripted constant.

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992