Click here to Skip to main content
15,888,984 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am trying to implement "Standard" and "Custom" installation options in setup project. I have following UI sequence: welcome form, Radio Buttons ( 2 buttons), Installation Folder, Confirm Installation.
The two radio buttons are for "Standard" installation and " Custom" installation.
When user selects " standard" installation the UI sequence should be :welcome form, Radio Buttons (2 buttons), Confirm Installation.
If user selects "Custom" installation then UI sequence should be same as initial i.e. : welcome form, Radio Buttons (2 buttons), Installation Folder, Confirm Installation.
I tried to implement using postbuildevent written in javascript. But it seems installation folder is getting skipped no matter which radio button is selected. Moreover FolderForm is getting displayed after Confirm Form. How to hide this form conditionally?

My javascript is as follows: (INSTALLPROCESS is the radio button property):

var msiOpenDatabaseModeTransact = 1;
var msiViewModifyInsert = 1
var msiViewModifyUpdate = 2
var msiViewModifyAssign = 3
var msiViewModifyReplace = 4
var msiViewModifyDelete = 6

if (WScript.Arguments.Length != 1)
{
WScript.StdErr.WriteLine(WScript.ScriptName + " filename.msi");
WScript.Quit(1);
}

var filespec = WScript.Arguments(0);
var installer = WScript.CreateObject("WindowsInstaller.Installer");
var database = installer.OpenDatabase(filespec, msiOpenDatabaseModeTransact);

var i = 0;
var paramName = "";
var paramVal = "";
var actionName = "";
var sql,sqlSub
var view,viewSub
var record,recordSub
var errorRecordFound = false;
//var rdval = [INSTALLPROCESS];
var errText = "";

try
{
WScript.Echo("Updating the ControlEvent table...");

var arrUpgradeButtonSequence1 = new Array
(
"Custom2Buttons_NextArgs","ConfirmInstallForm",
//"ConfirmInstallForm_PrevArgs","WelcomeForm"
"ConfirmInstallForm_PrevArgs","Custom2Buttons"
);



for(i =0; i < arrUpgradeButtonSequence1.length ; i+=2)
{

paramName = arrUpgradeButtonSequence1[i];
paramVal = arrUpgradeButtonSequence1[i+1];

actionName = "Set"+paramName+"ToUpgrade";
// create custom actions which change the properties to the upgrade once
sql = "INSERT INTO `CustomAction` (`Action`, `Type`,`Source`,`Target`) VALUES ('" + actionName + "',51,'"+ paramName +"','"+ paramVal +"')";
view = database.OpenView(sql);
view.Execute();
view.Close();

// put CustomAction runs into InstallUISequence on condition INSTALLPROCESS=1
sql = "INSERT INTO `InstallUISequence` (`Action`, `Condition`,`Sequence`) VALUES ('" + actionName + "','INSTALLPROCESS=\"1\"',900)";
view = database.OpenView(sql);
view.Execute();
view.Close();
}

paramName = "FolderForm_NextArgs";
paramVal = "";

actionName = "Set"+paramName+"ToUpgrade";
sql = "INSERT INTO `CustomAction` (`Action`, `Type`,`Source`,`Target`) VALUES ('" + actionName + "',51,'"+ paramName +"','"+ paramVal +"')";
view = database.OpenView(sql);
view.Execute();
view.Close();

sql = "INSERT INTO `InstallUISequence` (`Action`, `Condition`,`Sequence`) VALUES ('" + actionName + "','INSTALLPROCESS=\"1\"',900)";
view = database.OpenView(sql);
view.Execute();
view.Close();

database.Commit();
}
catch(e)
{
//WScript.StdErr.WriteLine(e);
//WScript.StdOut.WriteLine(e);
WScript.Echo(e.message + "\n" + errText);
WScript.Quit(1);
}
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900