Reputation: 1811
I want to enable users to browse and extract zip files at a specific location.
Requirements/steps:
DisableDirPage=no
)JDK
)JDK
zip file selected in step 3 at location selected in step 2, that means JDK
should be extracted in installation directory that user selects in step 2Problems with my code:
[SETUP]
AppName=My Program
AppVersion=1.5
DefaultDirName={pf}\My Program
DefaultGroupName=My Program
UninstallDisplayIcon={app}\MyProg.exe
DisableProgramGroupPage=no
DisableWelcomePage=no
DisableDirPage=no
Compression=lzma2
SolidCompression=yes
OutputDir=userdocs:Inno Setup Examples Output
[Files]
Source: "{code:GetLicensePath}"; DestDir: "{app}"; Flags: external
Source: "7za.exe"; DestDir: "D:\authorized\Builds\Solo\"; Flags: deleteafterinstall;
[Icons]
Name: "{group}\My Program"; Filename: "{app}\MyProg.exe"
[Run]
Filename: D:\authorized\Builds\Solo\7za.exe; Parameters: "x ""{{Code:GetZipPath}}"" -o""{app}\"" * -r -aoa"; Flags: runhidden runascurrentuser;
[Code]
var
Page: TInputFileWizardPage;
DataDir:String;
procedure InitializeWizard();
begin
Page :=
CreateInputFilePage(
wpWelcome,
'Select Zip File Location',
'Where is your Zip file located?',
'Select where Zip file is located, then click Next.');
Page.Add(
'Location of Zip file:',
'*.7z|*.rar|All files|*.*',
'.zip');
// Set initial value (optional)
Page.Values[0] := ExpandConstant('{%USERPROFILE}\Downloads\setup.7z');
;
end;
function GetZipPath(Param: string): string;
begin
DataDir := Page.Values[0];
end;
Could you help me, please?
Upvotes: 1
Views: 1075
Reputation: 202594
The order of your custom page is determined by the first argument of the Create*
function. So change wpWelcome
to wpSelectDir
.
Why double {{...}}
- That’s likely the problem. Also code:
should be lowercase.
Your scripted constant function does not really return anything. It should be:
Result := Page.Values[0];
Upvotes: 2