English 中文(简体)
Changing AppID and AppName based on user input
原标题:
  • 时间:2010-01-04 13:13:57
  •  标签:
  • inno-setup

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

最佳回答

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}ApplicationMyApp
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;
问题回答
  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.





相关问题
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 ...

InnoSetup: Getting AppName in [Code] section

I m creating an installer using InnoSetup, and writing some custom handlers in a [Code] section. In one of the handlers, I would like to be able to retrieve the value of the AppName (or, potentially, ...

Building Installation Disk for My Delphi 2010 Application

Can someone please give me a step by step on how to build an installation disk for my Delphi 2010 application? I have tried both InstallAware Express Edition which comes with Delphi 2010 but keeps on ...

Inno Setup custom welcome page

How can I customize the welcome page of an Inno Setup installer? I want to create an installer similar to Skype s installer with only 3 pages: Custom Welcome Page with some options Progress Page ...

Why would an ocx control not register properly?

I am writing an app that needs to use a third party ocx control. In my Inno Setup script I include the line: Source: C:aPathaControl.ocx; DestDir: {app}; Flags: restartreplace sharedfile regserver ...

Modifying the color scheme for an Inno Setup Installer

I ve been playing around with Inno Setup 5.3.6; trying to customize the installers colors. Mainly the banner that appears at the head of the installer. But as of yet i have no luck finding a way of ...

How do you distribute an HTML/Javascript web app?

I ve built a web page using HTML and Javascript that acts like a desktop app. I d like to distribute it to users in the methods they are most familiar with. For Windows users, I think this is an ...

热门标签