PDA

View Full Version : 'Ignore Exit Code' - How Can I Use It?



T.J. Regan
12-07-2001, 04:58 PM
In invoking a custom action in 3.53, I'm not sure of the use of the 'Ignore Exit Code' option.

If I leave the default of No, what can I get InstallShield Express to do based on the exit code? Stop the installation?

I would also like to see an example of how to set the exit code in my script.

Thanks.

T.J. Regan
12-09-2001, 05:18 PM
The following return values work, but there might be others:

1 = OK
2 = Cancel - Implies user cancelled
3 = Abort - Implies script error.

Any other data would be welcome.

Chandima
12-10-2001, 11:37 AM
You are correct about your deductions on the Exit codes. However it's not the reason we put that feature in! The reason we put it in was becasue some Exe custom actions return values which the Windows Installer interprets as error values and halts the install. This was causing various (and confusing) runtime errors. One case we ran in to was I think Windows Explorer on a 2K machine. So this is just a cautionary property you can set in case you are using 3rd party exe's which MIGHT have invalid return values.

T.J. Regan
12-10-2001, 12:52 PM
Thanks for the reply. I understand what you are saying about the purpose of the exit codes.

Here is what I was doing:

When the installation starts, I want to check the user's system. If the user does not have Microsoft Word installed, I want to give them a message box stating that they need to install Word. Then, I want to exit the installation.

I have the script written that determines if Word is installed. My .VBS script solves the exiting issue by returning the appropriate error code.

I would welcome a different solution. Thanks.

Chandima
12-17-2001, 01:31 PM
It seems that the Installer expects VBScript return direct Windows Installer values. Shown below is a small script another user submitted which seemed to make VBScripts actually return values that the installer understood.

----------------------------------------------------------------------------------
You can use one of the predefined values of msi.h
function foo()
foo = 1627
end function

this will work.

If you want to display a nice message, you can use session.Message (I didn't test that)


you could use an appropriate value from this set
#define ERROR_INSTALL_USEREXIT 1602L // User cancel installation.
#define ERROR_INSTALL_FAILURE 1603L // Fatal error during installation.
#define ERROR_FUNCTION_FAILED 1627L // Function failed during execution
-----------------------------------------------------------------------------------

Are you familiar with the Windows Installer? You can get Windows Installer itself to search for Access if you like. It's a little complicating and involves manually editing the msi using a tool like ORCA. For further information refer the msi help on the "Appsearch Table", "Signature Table" and "LaunchCondition" Table.