开发者

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).

  1. In in my setup script I want to change the AppID and AppName based on input from the user (for example my default AppName="Service App" should be changed to AppName="Service App One" if the user has entered "One").

  2. Above changes should be reflect开发者_运维知识库ed in the "Select Start Menu Folder" page.

  3. 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.


  1. 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 the AppID. I don't think it makes sense to do this for AppName, as according to the documentation it is used for display purposes in the wizard only.

  2. You should insert your custom input page before the "Select Destination Location" page and try to use a {code...} constant for DefaultDirName too, using the value the user entered before.

  3. See the CodeDlg.iss sample script for adding wizard pages and the NextButtonClick 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;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜