Monday, July 19, 2010

Fully qualified path about Setup.exe in InstallScript MSI project

Sometimes we need to get the value of the directory from where we are running the setup.exe. 


For ex:
To execute some scripts placed on the CD-ROM along with the exe or msi.



GetCurrentDir()


Syntax:
GetCurrentDir( svCurrentDir );
where svCurrentDir returns the current directory.

Thursday, July 8, 2010

Check Windows installer version

The set keyword must precede the assignment of an OBJECT variable to a reference returned by the CreateObject function. For example:

function OnBegin( )
OBJECT oMSI;
begin
// create the object
set oMSI = CreateObject("WindowsInstaller.Installer");

// use the object (display MSI version on user's system)
MessageBox("Your MSI version is: " + oMSI.Version, INFORMATION);

// free the object
set oMSI = NOTHING;
end;

Wednesday, July 7, 2010

To get TextChange, ListBox select, ComboBox Select event


CtrlGetSubCommand:
The CtrlGetSubCommand function retrieves the action performed on a control in a custom dialog. For example, CtrlGetSubCommand can tell you if the user single-clicked or double-clicked a list box or combo box control. It can also tell you when the contents of an edit field have changed.

Advanced developers can call CmdGetHwndDlg to handle additional information.

Syntax:

CtrlGetSubCommand (szDialogName);

szDialogName -- Specifies the name of a custom dialog.
Return Values:
CtrlGetSubCommand Return Values:
EDITBOX_CHANGE (-1007) -- The contents of the edit box have changed.

LISTBOX_ENTER (-1008) -- The user double-clicked a list box item.
LISTBOX_SELECT (-1009) -- The user single-clicked a list box item.

Monday, July 5, 2010

Working with XML

Hi, following post will give you a clear idea how to update xml element data, with the help of installshield data. This scenario will come where we need to either modify config files at the end of our installation program.


// Set XML Doc Type
set oDoc = CreateObject("Msxml2.DOMDocument.4.0");
oDoc.setProperty("SelectionLanguage", "XPath");


// set up variable with fullpath to config file
szConfigFile = "C:\app.config" ;


// set up the XPath for your target node and setting you are going to change
szXPath = "/configuration/userSettings/Client.Properties.Settings/setting[@name='WebUrl']";


// load the XML document into memory
if oDoc.load(szConfigFile) then


//Set the XPath in the XML
set oNode = oDoc.documentElement.selectSingleNode(szXPath);


//Update the XML Element
oNode.text = szCurrentURI;


endif;


// Save the XML Changes
oDoc.save(szConfigFile);


set oDoc = NOTHING;