marko001 Posted January 25, 2022 Posted January 25, 2022 (edited) Hi all guys, In my code sometimes I get this error on my compiled Crypto analyzer There are 2 objects that can lead to this: 1) Telegram Func __HttpGet($sURL,$sData = '') Local $oHTTP = ObjCreate("WinHttp.WinHttpRequest.5.1") $oHTTP.Open("GET",$sURL & "?" & $sData,False) If (@error) Then Return SetError(1,0,0) $oHTTP.Send() If (@error) Then Return SetError(2,0,0) If ($oHTTP.Status <> $HTTP_STATUS_OK) Then Return SetError(3,0,0) Return SetError(0,0,$oHTTP.ResponseText) EndFunc ;==> __HttpGet 2) API integration with Crpyto Exchanges Local $oHTTP = ObjCreate($oObject) $sURL = $g_sCrypto_URL & $sURL $oHTTP.Open($oMode, $sURL, False) $oHTTP.Send() Local $sReceived = $oHTTP.ResponseText ConsoleWrite($sReceived) These errors are not critical but annoying because they open Pop-Up and if I'm not in front of the screen program freezes (API calls are called by multitask calls) How can avoid to have the pop-up showing? Surely not this: $oMyError = ObjEvent("AutoIt.Error","MyErrFunc") ; Initialize a COM error handler ; This is my custom defined error handler Func MyErrFunc() Msgbox(0,"AutoItCOM Test","We intercepted a COM Error !" & @CRLF & @CRLF & _ "err.description is: " & @TAB & $oMyError.description & @CRLF & _ "err.windescription:" & @TAB & $oMyError.windescription & @CRLF & _ "err.number is: " & @TAB & hex($oMyError.number,8) & @CRLF & _ "err.lastdllerror is: " & @TAB & $oMyError.lastdllerror & @CRLF & _ "err.scriptline is: " & @TAB & $oMyError.scriptline & @CRLF & _ "err.source is: " & @TAB & $oMyError.source & @CRLF & _ "err.helpfile is: " & @TAB & $oMyError.helpfile & @CRLF & _ "err.helpcontext is: " & @TAB & $oMyError.helpcontext _ ) Endfunc Maybe this? $oMyError = ObjEvent("AutoIt.Error","MyErrFunc") ; Initialize a COM error handler ; This is my custom defined error handler Func MyErrFunc() msgbox(48,"Error","API communication error",5) ; <--- should close in 5 secs Endfunc Could it work ? Thanks in advance Edited January 25, 2022 by marko001
Nine Posted January 25, 2022 Posted January 25, 2022 Remove the msgbox from the error handling function ? Just do a ConsoleWrite or log the information into a log file ? “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
ad777 Posted January 25, 2022 Posted January 25, 2022 (edited) @marko001 let it be in Line of Script: $oMyError = ObjEvent("AutoIt.Error","MyErrFunc") Remove MsgBox From Function: MyErrFunc() -replace it content's[MyErrFunc()] with -> Return true or empty just Put ; after If @error Then MsgBox(.... if there is any... ex: ;If @error Then MsgBox($MB_SYSTEMMODAL, "COM Error", "@error is set to COM error number." & @CRLF & "@error = 0x" & Hex(@error)) Edited January 25, 2022 by ad777 none
Gianni Posted January 26, 2022 Posted January 26, 2022 (edited) Use ConsoleWriteError() in MyErrFunc() of the external child task; and use StderrRead() in the main script. Edited January 26, 2022 by Chimp Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now