cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
RakeshPatil
Level 5

Need help in creating option based installer

Hi,
I am trying to do the option based installer.
I have three exe's e.g.one.exe,two.exe,three.exe.
What I want to do is like,at the begining of installation installer should give three options to user asking which exe you want to install.That means it should give three options.So what should be my approach.
Please provide me your guidance on this.
Thanks in advance.
Labels (1)
0 Kudos
(6) Replies
MSIYER
Level 8

What type of project are you going to use?
0 Kudos
gayathrim
Level 4

Hi Rakesh,

If you are using Installscript msi project, then create a custom dialog providing three options and depending upon the selection, launch respective exe.

Hope this helps

Thanks,
Gayathri
0 Kudos
RakeshPatil
Level 5

gayathrim wrote:
Hi Rakesh,

If you are using Installscript msi project, then create a custom dialog providing three options and depending upon the selection, launch respective exe.

Hope this helps

Thanks,
Gayathri


Thanks Gayatri for your reply.
I am using installscript MSI project.I have already created custom dialog providing three options.But I don't know how to launch exe's based on selection through installscript and what shhould be the script.
Can you please help me about this.
0 Kudos
gayathrim
Level 4

Hi Rakesh,

Below is the sample code for dialog with 3 radio buttons as per ur requirement


**********************************************************
#define DIALOG_ID 12611 //define dialog id in properties

#define radiobutton1 1302 //radiobutton control id
#define radiobutton2 1303
#define radiobutton3 1304

#define BUT_BACK 12
#define BUT_NEXT 1
#define BUT_CANCEL 9



prototype Options();

BOOL bone, btwo, bthree;
function Options()
STRING szDialogName;
BOOL bDone;
NUMBER nResult, nCmdValue, returnVal, hInstance, nReturn, hwndDlg;

begin

// Specify a name to identify the custom dialog in this setup.
szDialogName = "Options";
// Define the dialog. Pass a null string in the second parameter
// to get the dialog from _isuser.dll or _isres.dll. Pass a null
// string in the third parameter because the dialog is identified
// by its ID in the fourth parameter.

nResult = EzDefineDialog(szDialogName, "", "", DIALOG_ID);
if (nResult < 0) then
// Report an error; then terminate.
MessageBox ("Error in defining dialog", SEVERE);
abort;
endif;

// Initialize the indicator used to control the while loop.
bDone = FALSE;

// Loop until done.
repeat
// Display the dialog and return the next dialog event.
nCmdValue = WaitOnDialog("Options"); //Options is the dialog name

// Respond to the event.
switch (nCmdValue)

case DLG_CLOSE:
Do (EXIT);

case DLG_ERR:
MessageBox ("Dialog failed.", SEVERE);
abort;
bDone = TRUE;


case DLG_INIT:
//write code on intialization

case radiobutton1:
bone = CtrlGetState("Options", radiobutton1);


case radiobutton2:
btwo = CtrlGetState("Options", radiobutton2);


case radiobutton3:
bthree = CtrlGetState("Options", radiobutton3);


case BUT_CANCEL: //Cancel button
Do(EXIT);

case BUT_BACK:
returnVal = 12;
bDone = TRUE;

case BUT_NEXT:
bone = CtrlGetState("Options", radiobutton1);
btwo = CtrlGetState("Options", radiobutton2);
bthree = CtrlGetState("Options", radiobutton3);
returnVal = 1;
bDone = TRUE;



endswitch;

until bDone;


// Close the dialog box.
EndDialog("Options");
// Free the dialog box from memory.
ReleaseDialog("Options");

return returnVal;
end;

**********************************************************

if you want to launch exe in the beginning, then in OnBegin event,

function OnBegin()
begin
nReturn = Options(); //custom dialog
if(nReturn = NEXT) then
//place your exes in SUPPORTDIR
if(bone = BUTTON_CHECKED) then
LaunchAppAndWait("cmd /c ", SUPPORTDIR ^ "one.exe", WAIT);
elseif(btwo = BUTTON_CHECKED) then
LaunchAppAndWait("cmd /c ", SUPPORTDIR ^ "two.exe", WAIT);
elseif(bthree = BUTTON_CHECKED) then
LaunchAppAndWait("cmd /c ", SUPPORTDIR ^ "three.exe", WAIT);
endif;
endif;
end;


This is sample only please change accordingly.
Hope this helps

Thanks,
Gayathri
0 Kudos
RakeshPatil
Level 5

gayathrim wrote:
Hi Rakesh,

Below is the sample code for dialog with 3 radio buttons as per ur requirement


**********************************************************
#define DIALOG_ID 12611 //define dialog id in properties

#define radiobutton1 1302 //radiobutton control id
#define radiobutton2 1303
#define radiobutton3 1304

#define BUT_BACK 12
#define BUT_NEXT 1
#define BUT_CANCEL 9



prototype Options();

BOOL bone, btwo, bthree;
function Options()
STRING szDialogName;
BOOL bDone;
NUMBER nResult, nCmdValue, returnVal, hInstance, nReturn, hwndDlg;

begin

// Specify a name to identify the custom dialog in this setup.
szDialogName = "Options";
// Define the dialog. Pass a null string in the second parameter
// to get the dialog from _isuser.dll or _isres.dll. Pass a null
// string in the third parameter because the dialog is identified
// by its ID in the fourth parameter.

nResult = EzDefineDialog(szDialogName, "", "", DIALOG_ID);
if (nResult < 0) then
// Report an error; then terminate.
MessageBox ("Error in defining dialog", SEVERE);
abort;
endif;

// Initialize the indicator used to control the while loop.
bDone = FALSE;

// Loop until done.
repeat
// Display the dialog and return the next dialog event.
nCmdValue = WaitOnDialog("Options"); //Options is the dialog name

// Respond to the event.
switch (nCmdValue)

case DLG_CLOSE:
Do (EXIT);

case DLG_ERR:
MessageBox ("Dialog failed.", SEVERE);
abort;
bDone = TRUE;


case DLG_INIT:
//write code on intialization

case radiobutton1:
bone = CtrlGetState("Options", radiobutton1);


case radiobutton2:
btwo = CtrlGetState("Options", radiobutton2);


case radiobutton3:
bthree = CtrlGetState("Options", radiobutton3);


case BUT_CANCEL: //Cancel button
Do(EXIT);

case BUT_BACK:
returnVal = 12;
bDone = TRUE;

case BUT_NEXT:
bone = CtrlGetState("Options", radiobutton1);
btwo = CtrlGetState("Options", radiobutton2);
bthree = CtrlGetState("Options", radiobutton3);
returnVal = 1;
bDone = TRUE;



endswitch;

until bDone;


// Close the dialog box.
EndDialog("Options");
// Free the dialog box from memory.
ReleaseDialog("Options");

return returnVal;
end;

**********************************************************

if you want to launch exe in the beginning, then in OnBegin event,

function OnBegin()
begin
nReturn = Options(); //custom dialog
if(nReturn = NEXT) then
//place your exes in SUPPORTDIR
if(bone = BUTTON_CHECKED) then
LaunchAppAndWait("cmd /c ", SUPPORTDIR ^ "one.exe", WAIT);
elseif(btwo = BUTTON_CHECKED) then
LaunchAppAndWait("cmd /c ", SUPPORTDIR ^ "two.exe", WAIT);
elseif(bthree = BUTTON_CHECKED) then
LaunchAppAndWait("cmd /c ", SUPPORTDIR ^ "three.exe", WAIT);
endif;
endif;
end;


This is sample only please change accordingly.
Hope this helps

Thanks,
Gayathri



Thanks Gayatri for this sample code.
I am trying to use it in my sample app.But I have one query about location of source exe's.Where should I place them.And how should SUPPORTDIR is used to find those exe's and launch them.
Sorry for more queries.But as I am new to installer I am facing these kind of issues.
0 Kudos
MSIYER
Level 8

SUPPORTDIR is used when you include files in the Support Files/Billboard view.
The path to these files are retrieved at install time using SUPPORTDIR.

I would have done the following:
Create three features. One for each exe.

Just use AskOptions dialog in the appropriate way to display three options.

Use FeatureSelectItem function to select or deselect the feature according to the return values from the AskOptions dialog.
0 Kudos