Changing AppID and AppName based on user input
I want to install the same application multiple times on the same system, for example for two user using two different web services (each one has their own).
In in my setup script I want to change the
AppID
andAppName
based on input from the user (for example my defaultAppName="Service App"
should be changed toAppName="Service App One"
if the user has entered "One").Above changes should be reflect开发者_运维知识库ed in the "Select Start Menu Folder" page.
How can the Next click events for the "Select Start Menu Folder" and the "Select Destination Location" wizard pages be caught? This is required to validate the user input.
AppID
can include{code...}
constants (see the Inno Setup documentation), so you are free to add a custom wizard page to enter the additional string that is part of theAppID
. I don't think it makes sense to do this forAppName
, as according to the documentation it is used for display purposes in the wizard only.You should insert your custom input page before the "Select Destination Location" page and try to use a
{code...}
constant forDefaultDirName
too, using the value the user entered before.See the
CodeDlg.iss
sample script for adding wizard pages and theNextButtonClick
handler.
It's not a conplete answer to your question, but I thought I'd show it anyway. If you are into scripts you can maybe take it as a starting point.
In my scripts I want the copyright year (AppCopyright) to reflect the current year (when the script is build).
I use the following code:
AppCopyright=2003-{code:TodayAsYYYY} © E.De.L.Com bvba
Notice the {code:FunctionName}
In the [code] section at the end of the script I have the following routine:
function TodayAsYYYY(param:string) : string;
begin
Result := GetDateTimeString('yyyy', #0, #0);
end;
function TodayAsYYYYMMDD(param:string) : string;
begin
Result := GetDateTimeString('yyyymmdd', #0, #0);
end;
As I said, it's not a complete answer. But I use InnoSetup maybe 1, 2 weeks a year, so I can't help you any more. Hope it helps, anyway.
Hi thanks for replying after some struggle I found answers to my own question and then realised maybe I was not asking the question correctly.
The output required was having two separate installed application with their own uninstaller under the start menu and thought Changing Appid and Appname will do the trick.
Here's what I did
#define MyAppName "My Application"
[Setup]
DefaultDirName={pf}\Application\MyApp
DefaultGroupName={#MyAppName}
above two required editing which was possible in the custom pages using following
WizardForm.DirEdit.Text := 'for DefaultDirName' (Select Destination Location")
WizardForm.GroupEdit.Text:= 'DefaultGroupName'
WizardGroupValue is used for reading values of "Select Start Menu"
for accessing the next event on in built wizard I used the following
//Validate Select Start Menu and Destination values
function NextButtonClick(CurPageID: Integer): Boolean;
var
ResultCode: Integer;
begin
case CurPageID of
wpSelectDir:
begin
//Do validation
end;
wpSelectProgramGroup:
begin
//Do validation
end;
end;
Result := True;
end;
精彩评论