I installed the script below to ask the user about the IP address as the installation wizard, this address is written to the configuration file that the application will link to in order to know what to contact. I would like to offer the opportunity to specify this IP address as a parameter on the command line so that you can automate and perform the deployment without pauses.
From my research, it seems possible to add a command-line option, but I'm struggling to figure out how to install this in my Inno installation, and then how I can make it optional so that it can be specified on the command line or using the installation wizard.
For example, something like app1.exe /ipaddress 192.168.0.1
Sorry if this is a simple process, I'm new to Inno Setup, so any help would be appreciated.
Can someone offer any help to help me get this setting?
[Code] var PrimaryServerPage: TInputQueryWizardPage; function FileReplaceString(ReplaceString: string):boolean; var MyFile : TStrings; MyText : string; begin Log('Replacing in file'); MyFile := TStringList.Create; try Result := true; try MyFile.LoadFromFile(ExpandConstant('{app}' + '\providers\win\config.conf')); Log('File loaded'); MyText := MyFile.Text; { Only save if text has been changed. } if StringChangeEx(MyText, 'REPLACE_WITH_CUSTOMER_IP', ReplaceString, True) > 0 then begin; Log('IP address inserted'); MyFile.Text := MyText; MyFile.SaveToFile(ExpandConstant('{app}' + '\providers\win\config.conf')); Log('File saved'); end; except Result := false; end; finally MyFile.Free; end; Result := True; end; procedure InitializeWizard; begin PrimaryServerPage := CreateInputQueryPage( wpWelcome, 'Application Server Details', 'Where is installed?', 'Please specify the IP address or hostname of your ' + 'Primary Application Server, then click Next.'); PrimaryServerPage.Add('Primary Application Server IP/Hostname:', False); end; procedure ReplaceIPAddress; begin FileReplaceString(PrimaryServerPage.Values[0]); end;
source share