Jump to content
argumentum

/ErrorStdOut from within ?

Recommended Posts

argumentum

Let's start with my code, that by my many years of coding, can not crash.

main()
Func main()
    OnAutoItExitRegister("__OnAutoItExit")
    Local $n, $a[6] = [5, 5, 4, 3, 2, 1]
    For $n = 1 To 100
        ToolTip('..crashing in ' & $a[$n], 50, 50, "CrashTest")
        ConsoleWrite('..crashing in ' & $a[$n] & @CRLF)
        Sleep(500)
    Next
EndFunc   ;==>main
Func __OnAutoItExit()
    Local $sExitMethod
    Switch @exitMethod
        Case 0
            $sExitMethod = "closed by natural closing."
        Case 1
            $sExitMethod = "closed by Exit function."
        Case 2
            $sExitMethod = "closed by clicking on exit of the systray."
        Case 3
            $sExitMethod = "closed by user logoff."
        Case 4
            $sExitMethod = "closed by Windows shutdown."
        Case Else
            $sExitMethod = "closed by no clue."
    EndSwitch
    MsgBox(262144, @ScriptName, "I could do something with the error from here" & @CR & _
            @CR & "What is known is that was " & $sExitMethod & _
            @CR & "and the Exit was " & @exitCode & _
            @CR & @CR & " if I had the error string from ""/ErrorStdOut"", I could do more", 60)
EndFunc   ;==>__OnAutoItExit

How can I get the output from "/ErrorStdOut" from within the script ?
I know how to capture from another process ( another script or CMD > redirect.txt )
but that runs another process and there should be a simple way. Help ?, anyone ? 

Edit: maybe a way to read the error type as integer and line# as integer from memory ? not necessarily the output string ? 

Edited by argumentum

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

×