- Revenera Community
- :
- InstallShield
- :
- InstallShield Knowledge Base
- :
- InstallScript : How to store an error code from a custom action.
- Mark as New
- Mark as Read
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
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,