Recently Browsing 0 members
No registered users viewing this page.
This is a UDF to handle the AutoIt Error msgbox when our awesome code goes
I've been using trancexx's code for the longest time and since I iron some wrinkles in my ( personal use ) UDF, decided to organize it in a dignifying way and post it.
The ZIP with the code is in the downloads area.
I'm posting this because most other handlers use /ErrorStdOut to catch errors and they are not that common, for us great coders
So makes little sense to me to run 2 EXEs for something unlikely to happen. No one made a UDF of this, so, I did.
oh, ..there are things where this will be of no use, say, infinite recursion or what not, so, if the the AutoIt Error msgbox was to popup then this UDF should do it.
...let me know if you liked it, or post your views to better it.
There is also an EventViewer_GetMyEntries() down this post that may come in handy.
#NoTrayIcon If @Compiled Then Exit MsgBox(262144, @ScriptName, "run this test from SciTE" & @CR & "this is just a test", 5) #include <WinAPI.au3> ; for _WinAPI_FindWindow #include <Misc.au3> ; for _IsPressed If StringInStr($CmdLineRaw, "DoACrash") Then DoACrash() Func DoACrash() Local $a = "caca" $a = "more caca" EndFunc ;==>DoACrash Run('"' & @AutoItExe & '" "' & @ScriptFullPath & '" DoACrash') ; to create the initial crash catchTheCrash() Func catchTheCrash() AutoItWinSetTitle("if this window not found, then, a crash catcher is wanted ???") Local $hDLL = DllOpen("user32.dll") Local $w, $t = TimerInit() While 1 ToolTip("press and hold ""ESC"" to exit." & @CR & "loop time: " & Round(TimerDiff($t)) & " mSec.") $t = TimerInit() Sleep(20) If _IsPressed("1B", $hDLL) Then Exit 0 ; ESC key $w = _WinAPI_FindWindow("#32770", "AutoIt Error") ; very fast, does not affect CPU much If $w Then WinSetState($w, "", @SW_HIDE) ; all these are slow. Is there a faster way to not show the MsgBox ? ConsoleWrite("--- " & @MIN & ":" & @SEC & "." & @MSEC & @CRLF & _ ControlGetText("AutoIt Error", "", "Static2") & @CRLF) WinClose($w) Run('"' & @AutoItExe & '" "' & @ScriptFullPath & '" DoACrash') ; ..to keep on crashing ;) EndIf WEnd EndFunc ;==>catchTheCrash is there a faster way to get the info. and close the MsgBox ?