Search code examples
inno-setuptaskcustom-pages

Controlling Custom Page To Show After Specific Tasks


After couple of hours googling and struggling, and got no where, I decide to ask for help here.

What I am trying to accomplish, I am trying to get the IP from the user and use it as a command line parameter in my [Run] Section.

So I have this:

[Task]
Name: "License"; Description: "Usb Key License Driver"; GroupDescription: "UsbLicense"; Flags: checkedonce
Name: "License/Desktop"; Description: "Desktop License"; GroupDescription: "UsbLicense"; Flags: exclusive
Name: "License/NetworkClient"; Description: "Network Client License Key"; GroupDescription: "UsbLicense"; Flags: exclusive unchecked

Now if the user chooses Network client, I want to be able to show a custom page, and get the IP and use it like this:

[Run]
Filename: "{app}\Drivers\Program.exe"; Parameters: "/ip:{code:GetIPhere}"; StatusMsg: "Installing drivers..."; Tasks: License/NetworkClient

I managed to create my own page and ran this:

[Code]
procedure InitializeWizard();
begin
  CustomForm_CreatePage(wpSelectDir);
end;

Now for my main question:

1) How do i control WHEN the custom form shows, it shows up before it activates before my Task page.

2) If i can get it to show AFTER task page? How do I write code to make it show under the "Client Network" condition only from task. (If i do this in NextButtonClick method, how do i know what is the page id of my custom page?)

Thanks for all you help, i am just geting so close to finishing my installer, but this is driving me nuts.

----EDITED----

I sovled my problem 1, there is a pageAfter parameter when creating the custom page, and we can use the selectedTask constant to determine it to appear AFTER the Task page:

procedure InitializeWizard();
begin
  Form_CreatePage(wpSelectTasks);
end;

Thanks and Regards, Kev84


Solution

  • You can use the Pascal Script WizardSelectedTasks, which will return you the string of tasks you have created, just do a "Pos" on the returned string and you'll be able to determine if your specific task was chosen.

    [code]
    function Form_ShouldSkipPage(Page: TWizardPage): Boolean;
    var
     selectedTask : string;
     skipPage : bool;
    begin
      skipPage := true;
      selectedTask := WizardSelectedTasks(false);
    
      if (Pos('client', selectedTask) > 0) then
      begin    
        skipPage := false;
      end;
      Result := skipPage;
    
    end;