Jump to content

/ErrorStdOut from within ?


Recommended Posts

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

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Link to comment
Share on other sites

found a solution at https://www.autoitscript.com/forum/topic/143250-grab-runtime-errors-when-script-is-run-from-a-service/?do=findComment&comment=1009391

=)

Edited by argumentum
found a way almost a year after

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

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