/build/static/layout/Breadcrumb_cap_w.png

Wise - Using a variable for Application Exit Code

I'm using Wise Installation System 9.02

I want to have my script execute another program, and should it fail will an exit code other than 0, I want my script to exit with the same error code.

Put another way, if I call MSIExec to install an application and the installation fails with exit code 1603, I want to exit my wise script with exit code 1603.

Is there any way to use a variable for the Application Exit Code? Does anyone have any other ideas?

0 Comments   [ + ] Show comments

Answers (10)

Posted by: nortonl 15 years ago
Senior Yellow Belt
2
You can do this using the 'ExitProcess' Windows API function (it terminates the current process and allows you to specify the exit code).

Set a variable e.g. EXITCODE in your Mainline event code as required, e.g. after calling MSIEXEC, Set variable EXITCODE to %INSTALL_RESULT%.

In the Wise Script editor, select the 'Exit' event (this runs when an Exit Installtion command is used).

Add a 'Call DLL Function' command:

[blockquote]

DLL Pathname=%SYS32%\kernel32.dll
Function Name=ExitProcess
Select 'Call a function with variable parameter list'
Add parameter:

[blockquote]
Parameter Type=long
Passing Type=Normal
Value Source=Variable
Variable Name=EXITCODE[/blockquote]
Return Value Type=long[/blockquote]
Some more info on the Windows function

One thing to remember - the exit code integer specified in the Wise Exit Installation command will be ignored, so you if you want to control the exit code within your code, you need to remember to set the EXITCODE variable before exiting.
Posted by: yarborg 18 years ago
Blue Belt
0
You should be able to use the PROCEXITCODE variable in Wise when you execute another application. When you choose the script piece for "Execute program" make sure you check the "Wait" box and for the variable choose PROCEXITCODE. This should capture the exit code of the program you just called.

Hope that helps.
Posted by: BoyGenius 18 years ago
Orange Belt
0
That part isn't the problem. I don't have any problem determining the exit code of the called program, the issue is with the Exit function in Wise. It won't let me set the Application Exit Code programatically duing execution (at least I haven't figured out how).

When using the exit command, it demands that you enter an non-negative integer, and won't let me enter a variable name.
Posted by: BoyGenius 17 years ago
Orange Belt
0
While its not a cools as passing INSTALL_RESULT as the wrapper's exit code, I've found a happy medium:

I've configured my program to use an .MIF (I've never bothered to before). Now, if the installation launched by my wrapper exits with a code other than 0, my wrapper still exits with an exit code that means nothing, but I can include the results of INSTALL_RESULT in the text written to the .MIF.

...at least I think I can. I've just started testing.
Posted by: mupdike 15 years ago
Senior Yellow Belt
0
Can you tell me how you were able to create a .mif with your WiseScript to accomplish this? While I am still hoping I will find something that will allow me to exit with the appropriate code (after all that capability makes sense when used as a wrapper) I am researching alternate reporting methods.

Thank you!
Posted by: anonymous_9363 15 years ago
Red Belt
0
LOL...you're expecting an answer to a resurrected post from TWO YEARS AGO? :)

I Googled with the search term

WiseScript +".MIF"

I figure the top few hits ought to provide an answer for you or, at the very worst, some hefty clues.
Posted by: mupdike 15 years ago
Senior Yellow Belt
0
I knew there was a risk in resurrecting this old of a post. I was hoping that someone had a good link or method already doc'd that could be shared. I've been googling the issue, of course, and have found a few links with some potential but still hoped to find something a bit more concrete here.

Thanks!
Posted by: nortonl 15 years ago
Senior Yellow Belt
0
This method works just the same in older versions of Wise Script which do not have the Exit Code parameter on the Exit Installation command.
Posted by: nortonl 15 years ago
Senior Yellow Belt
0
Oops - just edited the above post as I left out the all important 'Function Name=ExitProcess'.
Posted by: norexx 15 years ago
Orange Belt
0
Fyi: Late to the party here (and resurrecting this thread for the third time), but just tried nortonl's method. Am happy to report it works great, and --even better-- much simpler than messing with .mif files.

I also found a handy VBscript someone posted to verify the Execute Program's "%INSTALL_RESULT%" value is really being passed along as the "wrapper" EXE's final exit code:
https://www-secure.symantec.com/community/download/10831/vbscript-install-application-exit-code

Hope this helps!
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ