Jump to content

Decoding Exitcodes


kut
 Share

Recommended Posts

Since I cannot post in the Examples-section, have my script here.

It maps exit code numbers to error descriptions. You need the attached text file (unzipped) in the same folder as the script. I copy-pasted the descriptions from a web page. You might want to look for your localized ones.

func exitmsg($exitcode)
    $file = fileopen("exitmsg.txt", 0)
    if $file = -1 then 
        msgbox(0, "Error", "Cannot read file exitmsg.txt")
        return $exitcode
    EndIf
    
    while true 
        $line = FileReadLine($file)
        if @error = -1 Then return $exitcode
            
        $firstblank=StringInStr($line, " ")
        if stringleft($line, $firstblank) = $exitcode then return stringtrimleft($line, $firstblank)        
    WEnd
    
EndFunc

Parsing the description file only takes fractions of a second for a single lookup, but if you need to batch-convert exitcodes better read it in once...

You can also include the exitmsg.au3 in your scripts and just call the function.

Enjoy the errors!

exitmsg.zip

exitmsg.au3

Link to comment
Share on other sites

  • Developers

Originele User naam ...

You can post in the Example's when you have reached 10 posts .

Edited by JdeB

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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...