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

InstallScript : How to store an error code from a custom action.

InstallScript : How to store an error code from a custom action.

Description:

 This article will discuss how to store a return/error code generated by a custom action.

Ex:

If the exe file is displaying its own message to the user The error message that's being displayed when the error code returns may be undesirable.

Solution:

1. Create a custom action with deferred execution.

2. Installscript code to store the error code:

Function CheckProduct(hMSI)

String returnCodeStr;
Number nvSize,returnCode;

begin

nvSize=250;

//Run exe

SprintfMsiLog("path="+INSTALLDIR+"\\AAA.exe");
returnCode=LaunchApplication(INSTALLDIR+ "\\AAA.exe", "/c", INSTALLDIR, SW_NORMAL,LAAW_PARAMETERS.nTimeout,LAAW_OPTION_WAIT);
NumToStr(returnCodeStr,returnCode);

//Return Value

SprinfMsiLog("returnCode="+returnCodeStr);
if(returnCode=0)then
SprintfMsiLog("Result Success");
return ERROR_SUCCESS;
else
SprintfMsiLog("Result Failure");
return ERROR_INSTALL_FAILURE;
endif;
end;

Where AAA.exe if the exe file which displays its own message to the user. You can use your own exe.

3. Create a SetPropertyTask and use the CustomActionData to get the property into InstallScript. SetProperty that will copy the value to the CustomActionData property.

More Info,

https://www.revenera.com/blog/software-installation/it-wants-me-to-do-what-some-notes-on-customactiondata-in-installshield/

Was this article helpful? Yes No
No ratings
Version history
Last update:
‎May 20, 2021 03:05 AM
Updated by:
Contributors