Jump to content

UDF for error code descriptions


lyledg
 Share

Recommended Posts

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

Link to comment
Share on other sites

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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...