How can I include an random number in a string in Inno Setup?
[Run]
#define rndH Random(24)
#define rndM Random(60)
Filename: "schtasks"; \
Parameters: "/Create /F /SC DAILY /ST {rndH}:{rndM} /RU SYSTEM /RL HIGHEST /TN ""Program Title"" /TR ""'{app}\program.exe'""";
When I try the code above, I get an error
[ISPP] Undeclared identifier: "Random"
Thanks
The code in your answer works, but it is unnecessarily complicated:
Format
function to pad the number to two digits;[Run]
Filename: "schtasks"; \
Parameters: "/Create /F /SC DAILY /ST {code:MyRand|24}:{code:MyRand|60} ...";
[Code]
function MyRand(Param: string): string;
begin
Result := Format('%.2d', [Random(StrToInt(Param))]);
end;