5

I want to use the [Files] section to create a new file which has the format:

Program Name plus date plus time .fmpur

I'd be grateful for any ideas.

TLama
  • 75,147
  • 17
  • 214
  • 392
John Carpmael
  • 139
  • 1
  • 3
  • 8

2 Answers2

6

For instance the following way. How to modify a date time pattern, see the GetDateTimeString page:

[Setup]
AppName=My Program
AppVersion=1.5
DefaultDirName={pf}\My Program

#define FileNamePattern SetupSetting("AppName") + " " + GetDateTimeString('dd-mm-yyyy hh-nn-ss', '-', ':') + ".fmpur";

[Files]
Source: "MyProg.exe"; DestDir: "{app}"; DestName: "{#FileNamePattern}"
TLama
  • 75,147
  • 17
  • 214
  • 392
  • @TLama Does this use the date at the time of build or the date that the setup is run? I need the date that the setup is run. – RichC Feb 13 '15 at 13:33
  • @RichC, the function used here is a preprocessor function, so it's a pre-compilation timestamp. – TLama Feb 13 '15 at 13:35
0

An alternative to TLama's example using a function to get the filename.

[code]
function GetFileName(Dummy: String): String;
begin
    Result := SetupSetting("AppName") + " " + GetDateTimeString('dd-mm-yyyy hh-nn-ss', '-', ':') + ".fmpur";
end;

[Files]
Source: "MyProg.exe"; DestDir: "{app}"; DestName: "{code:GetFileName}"
T.S
  • 355
  • 4
  • 18