tags:

views:

176

answers:

2

Hello guys! I'm creating an application for my company. And the goal is to create a universal installer that will be checking user's registry for specific apps installed and according to these apps would create a list of available installation components in "Select Components" window. And that's the particular problem I'm stacked with.

I've already created the installer, but a user have to check/uncheck components he doesn't need because he doesn't use specific app. That is definitely not a good way of doing thing I guess...

So I'm asking for help, please. Could this be implemented through "Select Components" window and how or I should create custom wizard page with checkboxes (again - How)?

Many thx in advance.

P.S. I've already used Check function in my script, but in this case the program automatically installs all of the components related to found apps on users machine, and sometimes users don't need that....

+1  A: 

This removes a component based on a registry value. You'd want to modify this to fit each application you are trying to install and would probably need a Check function for each application.

    ; -- Components.iss --
    ; Demonstrates a components-based installation.

    ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING .ISS SCRIPT FILES!

    [Setup]
    AppName=My Program
    AppVerName=My Program version 1.5
    DefaultDirName={pf}\My Program
    DefaultGroupName=My Program
    UninstallDisplayIcon={app}\MyProg.exe
    OutputDir=userdocs:Inno Setup Examples Output

    [Types]
    Name: "full"; Description: "Full installation"
    Name: "compact"; Description: "Compact installation"
    Name: "custom"; Description: "Custom installation"; Flags: iscustom

    [Components]
    Name: "program"; Description: "Program Files"; Types: full compact custom; Flags: fixed
    Name: "help"; Description: "Help File"; Types: full; Check: IsMyAppInstalled
    Name: "readme"; Description: "Readme File"; Types: full
    Name: "readme\en"; Description: "English"; Flags: exclusive
    Name: "readme\de"; Description: "German"; Flags: exclusive

    [Files]
    Source: "MyProg.exe"; DestDir: "{app}"; Components: program
    Source: "MyProg.chm"; DestDir: "{app}"; Components: help
    Source: "Readme.txt"; DestDir: "{app}"; Components: readme\en; Flags: isreadme
    Source: "Readme-German.txt"; DestName: "Liesmich.txt"; DestDir: "{app}"; Components: readme\de; Flags: isreadme

    [Icons]
    Name: "{group}\My Program"; Filename: "{app}\MyProg.exe"

    [Code]
    function IsMyAppInstalled(): Boolean;
    Var
      installed: String;

    begin
      if RegQueryStringValue(HKEY_CURRENT_USER, 'Software\MyApp',
         'Installed', installed) then
        result := true
      Else
        result := false;
    end;
mirtheil
Oh man, I used check function in [Files] but I did not thought it can be used in [Components] section too. Thank you very much for helping me! I should more carefully read inno's help file:
cyxou
Please replace `if RegQueryStringValue(HKEY_CURRENT_USER, 'Software\MyApp', 'Installed', installed) then result := true Else result := false;` with `result := RegQueryStringValue(HKEY_CURRENT_USER, 'Software\MyApp', 'Installed', installed)`
Andreas Rejbrand
A: 

What you want to do goes beyond Inno Setup design, and I think you need to write your own installer instead of using a generic installer framework such as Inno Setup.

Lex Li
Inno Setup supports Pascal scripting, so you can extend the functionality as you wish.
Andreas Rejbrand
mirtheil's advice helped me! But recently I've made my mind to deploy my project with WIX....
cyxou