Jump to content
Sign in to follow this  
lyledg

UDF for error code descriptions

Recommended Posts

lyledg

Hi guys

I have been writing a script for launching in particular *.msi's, and although I was able to get error codes back, I was not getting a helpful description of the error, short from researching on the internet for it.

So, I created this UDF that may come in handy which will provide a useful description of the error code returned from the Runwait command. (Note it only works with the Runwait command, not Run). I needed to write to the event viewer afterwards and having these handy descriptions helps pin point problems faster using the event viewer.

The great thing is that you could add custom error descriptions and codes that are not listed in this UDF; that would be particular to a specifc program.

An example of the script usage is included in the commented section of the UDF.

Comments welcome...

Cheers

lyledg

Exitcodes.au3

Share this post


Link to post
Share on other sites
Danny35d

This is the one I use:

Func _GetExitCode($iExitCode)
    Local $sLine = ''
    $Pid = Run(@ComSpec & " /c net helpmsg " & $iExitCode, @SystemDir, @SW_HIDE, 2)
    While 1
        $sLine &= StdoutRead($Pid)
        If @error Then ExitLoop     
    Wend
    Return(StringStripWS(StringStripCR($sLine), 3))
EndFunc


AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.