Search the Community
Showing results for tags 'error handling'.
-
I'm try to add error handle after autoit error ( I don't want the autoit error message show up ) My intention is to move the file, record the error script line and restart the script's .exe file due to an unexpected error while reading file's content I tried to use the ObjEvent with AutoIt.Error, but not work do I misunderstand how the AutoIt.Error work ? 'cause PIP I can't provide the original script, here is sample script with similar logic I tried ( $FT_Name unexpected error, content without @ char ) Global $errorFlow_Global = ObjEvent("AutoIt.Error", "error_Global") Global $File = "C:\Desktop\ABC.txt" Global $Name ; ============================== $Name = Fun_Test() ConsoleWrite("Name : " & $Name & @CRLF) Exit ; ============================== Func Fun_Test() Local $errorFlow_Local = ObjEvent("AutoIt.Error", "error_Local") Local $FT_Fle = $File, $FT_Content, $FT_Name _FileReadToArray($FT_Fle, $FT_Content) $FT_Name = StringSplit($FT_Content, "@")[1] Return $FT_Name EndFunc ; ============================== Func error_Global($eG_Info) ConsoleWrite("Global, error Line : " & $eG_Info.scriptline & @CRLF) FileMove($File, "C:\ABC", 1 + 8 ) Run(@ComSpec & " /c timeout /t 3&&C:\Desktop\ABC.exe") EndFunc ; ============================== Func error_Local($eL_Info) ConsoleWrite("Local, error Line : " & $eL_Info.scriptline & @CRLF) FileMove($File, "C:\ABC", 1 + 8 ) Run(@ComSpec & " /c timeout /t 3&&C:\Desktop\ABC.exe") EndFunc
- 4 replies
-
- error handling
- error
-
(and 1 more)
Tagged with:
-
Hello again, i have a code that changes username to favorite, my problem is how to use ObjEvent() function to catch errors, i've red Help File and Forum's Topics but i can't understand too much😐 Here is a code (I've copied this codes from a user of AutoIt Forum): $sOldUser = "Administrator" $sNewUser = "Admin" $oUser = ObjGet("WinNT://" & @ComputerName & "/" & $sOldUser & ",user") $oComputer = ObjGet("WinNT://" & @ComputerName) $oNewUser = $oComputer.MoveHere($oUser.ADsPath, $sNewUser) Thanks for your care, I'm new to AutoIt and days should be passed with my coding and practicing to don't bother you :)❤
- 6 replies
-
- obj
- error handling
-
(and 1 more)
Tagged with:
-
I have created some scripts using IE.au3 but i havent implemented any good error handling logic yet. In case of any errors IE.au3 prints the errors in the console. I believe those errors are printed to console using __IEErrorNotify function. I want to use these error messages and insert those into a text file or an excel. Any ideas? Basically if error messages are generated from IE.au3 after accessing its functions, then i want to write them to a file.
- 8 replies
-
- Error Handling
- IE.au3
-
(and 1 more)
Tagged with:
-
Greetings, someone can give a exemple, how send a error from a C#'s dll to AutoIt? I use this line, to send an error... but, I want get a error code In AutoIt with macro @error, it's possible? throw new ArgumentException("arquivo map não existe", "value" ); In this way, work, I know ther are error, but, @errror always is zero. I don't want this, I want a number as error code. Can you help me? Best regards
-
Hello, I've run in to a problem with DriveMapAdd sometimes failing with the Error=1 Extended=0 and the drive not mapping. So to give the user a better error description i found the command _WinAPI_FormatMessage which should give me wonderfull Windows messages, but it only returns a single letter. I found a wouldbe working code sniplet i could change to fit my needs, how ever it doesn't work for me as it is and even when i change it so that it doesn't produce errors it still doesn't work. It seems to have worked for the guy right here: '?do=embed' frameborder='0' data-embedContent>> Unedited: #include <WinAPI.au3> $n = 53; Error code MsgBox(64, "Test", _WinAPI_GetErrorMessage($n)) Func _WinAPI_GetErrorMessage($iErrorNum) Local $tText $tText = DllStructCreate("char Text[4096]") _WinAPI_FormatMessage($__WINAPCONSTANT_FORMAT_MESSAGE_FROM_SYSTEM, 0, $iErrorNum, 0, DllStructGetPtr($tText), 4096, 0) Return DllStructGetData($tText, "Text") EndFunc ;==>_WinAPI_GetErrorMessage My attempt: #include <WinAPI.au3> Local Const $FORMAT_MESSAGE_FROM_SYSTEM = 0x00001000 $n = 53; Error code MsgBox(64, "Test", _WinAPI_GetErrorMessage($n)) Func _WinAPI_GetErrorMessage($iErrorNum) Local $tText $tText = DllStructCreate("char Text[4096]") $ptext = DllStructGetPtr($tText) _WinAPI_FormatMessage($FORMAT_MESSAGE_FROM_SYSTEM, 0, $iErrorNum, 0, $ptext, 4096, 0) Return DllStructGetData($tText, "Text") EndFunc ;==>_WinAPI_GetErrorMessage Any help would be greatly apprisiated
- 2 replies
-
- @extended
- error handling
-
(and 1 more)
Tagged with: