Search the Community
Showing results for tags 'Error'.
-
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 everyone, my problem is that when I try to run my already compiled program as administrator I get this error, but when I run the script it works correctly. this is my code #include <MsgBoxConstants.au3> #include <Excel.au3> ;I use this code to not open a new excel file Global $sWorkbook = @ScriptDir & "\facturacion.xlsx" Global $oWorkbook = _Excel_BookAttach($sWorkbook) ;this line of code is the problem $num = $oWorkBook.ActiveSheet.Range("C2").value MsgBox(0,0, $num) ;this line of code is the problem $num = $oWorkBook.ActiveSheet.Range("C2").value Is there another way to obtain the data from a cell in an Excel file? Thanks for your time 😊
-
I'm using csharp with the autoitx3. I added to my project referenced the autoit dll's. Everything was working find until I got exception say: "Unable to load DLL 'AutoItX3_x64.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)" And I downloaded and installed the autoit and added the dll files referenced them to my project also the file name: AutoitX3_x64.dll but for some reason I don't see this dll file in the project tried to add it as reference few times and in the References I see only two files of Autoit: AutoItX3.Assembly.dll and Interop.AutoItX3Lib.dll but for some reason it's not adding the AutoitX3_x64.dll as reference. How should I add then the AutoitX3_x64.dll to my project ? I keep getting the exception message that it's missing.
-
Function Reference _AutoItErrorTrap.au3 UDF to intercept the error window of AutoIt, showing more details about the error, including ability to save and send by email! (Detection and treatment of errors in the AutoIt scripts!) Sintax: ; Adding the directives below, will cause your program be compiled with the indexing of the original lines shown in SciTE: #AutoIt3Wrapper_Run_Before=ShowOriginalLine.exe %in% #AutoIt3Wrapper_Run_After=ShowOriginalLine.exe %in% ;Or you can use the program "ShowOriginalLine.exe" directly and choose the script you want to add support to show the original lines! #include "_AutoItErrorTrap.au3" ; _AutoItErrorTrap ([sTitle [, sText [, fUseCallBack]]]) _AutoItErrorTrap()Supports: ;Error detection in your AutoIt script and local #Includes! ;According to the AutoIt Help, the definition for "local Includes" is: ;------------------------------------------------------------------------------ ;If "..." is used, the filename is taken to be relative to the current script. ;------------------------------------------------------------------------------ ;This means that for you to have your UDF or other external module with support to show the original lines, one should use as follows: #include "[path] filename" ; See the AutoIt help for more details.Downloads: Version: 0.11 _AutoItErrorTrap_(RedirectLink).html Note: The error detection is performed in the same executable, does not requiring opening two .exes for this action! Works with CUI too. Usage example is included! (You need to compile first, but it also work with non compiled scripts using context menu [Run Script...]) Sample: More sample: Fixes: #ShowLine_Off $hForm = GUICreate("My GUI menu", 480, 360) $iFileMenu = GUICtrlCreateMenu("&File") $iFileItem = GUICtrlCreateMenuItem("Open", $iFileMenu) GUICtrlSetState(-1, $GUI_DEFBUTTON) $iHelpMenu = GUICtrlCreateMenu("?") GUICtrlCreateMenuItem("Save", $iFileMenu) GUICtrlSetState(-1, $GUI_DISABLE) #ShowLine_OnWithout them the rows above would be as follows: $__iLineNumber=1 & " - " & '$hForm = GUICreate("My GUI menu", 480, 360)...' $hForm = GUICreate("My GUI menu", 480, 360) $__iLineNumber=3 & " - " & '$iFileMenu = GUICtrlCreateMenu("&File")' $iFileMenu = GUICtrlCreateMenu("&File") $__iLineNumber=4 & " - " & '$iFileItem = GUICtrlCreateMenuItem("Ope...' $iFileItem = GUICtrlCreateMenuItem("Open", $iFileMenu) $__iLineNumber=5 & " - " & 'GUICtrlSetState(-1, $GUI_DEFBUTTON)' GUICtrlSetState(-1, $GUI_DEFBUTTON) $__iLineNumber=6 & " - " & '$iHelpMenu = GUICtrlCreateMenu("?")' $iHelpMenu = GUICtrlCreateMenu("?") $__iLineNumber=7 & " - " & 'GUICtrlCreateMenuItem("Save", $iFileMenu)' GUICtrlCreateMenuItem("Save", $iFileMenu) $__iLineNumber=8 & " - " & 'GUICtrlSetState(-1, $GUI_DISABLE)' GUICtrlSetState(-1, $GUI_DISABLE) And the directive #ShowOriginalLine_Param with the following options: /SV or /SkipAllVars ; Skip all Variables to show original line numbers. /SG or /SkipGlobalVars ; Skip Global Variables to show original line numbers. /SL or /SkipLocalVars ; Skip Local Variables to show original line numbers.29/10/2012 -> *Adding the directives below, will cause your program be compiled with the indexing of the original lines shown in SciTE: #AutoIt3Wrapper_Run_Before=ShowOriginalLine.exe %in% #AutoIt3Wrapper_Run_After=ShowOriginalLine.exe %in%*Or you can use the program ShowOriginalLine.exe directly and choose the script you want to add support to show the original lines!*It was added #region Translations with the variables available for translation! 0.10.2312.2600b 25/10/2012 -> Added support for viewing the last screen before the error! Now the window can expand and retract again...Change the hook CALLWNDRETPROC to CALLWNDPROC (better...). Added a help button [?] In the main window and minor changes in the code. 0.10.2312.2600b 23/10/2012 -> *Added support to display the original line numbers in the scripts compiled! Thanks to @FireFox for this tip! $hAET_GETERROR = StringRegExpReplace($hAET_GETERROR, "d+[0-9]", Eval("__iLineNumber") & @CRLF)*Additional information suggested by @ricky03, thank you!*Some bugs were fixed and the file ShowOriginalLineNumbers.au3 was added in zip file. 0.10.2112.2600b 21/10/2012 -> Bugs were fixed and a few functions have been rewritten!0.10.1912.2600b 19/10/2012 -> The UDF was almost completely rewritten, now no longer need to include _AdlibEnhance.au3.The detection of error is instant and does not consume more CPU. Interface compatibility with Windows XP 0.10.1812.2600b 18/10/2012 -> Improvements such as icons on the buttons and added a button to save the error information!0.10.1712.2600b 17/10/2012 -> First release!Regards, João Carlos.
-
Hi Guys, I have a very, very, very long script. Occasionally, it throws up a strange error dialogue box. It's a standard Windows dialogue box, similar to that generated with the MsgBox ( flag, "title", "text" [, timeout = 0 [, hwnd]] ) command. However, it shows no line number, and the window just says "Error". There is a single Ok button, which when clicked causes the script to exit. It's not part of my coding, so I am guessing that it is being generated by the AutoIT interpreter, but I have no idea why. The script is hundreds of lines long, so it's not something which I can realistically trace without a line number. I do have other scripts which also run 24/7, and none of them have this problem. Any ideas as to why such an unknown error box gets generated. That would at least give me a starting point. Many thanks, Pete
-
This code causes an error: yacc stack overflow on line 249 Global $g_R2 = '1|0.1382|0.0031' & @CRLF & _ '2|0.1696|0.003' & @CRLF & _ '3|0.1994|0.003' & @CRLF & _ '4|0.2292|0.003' & @CRLF & _ '5|0.2592|0.0028' & @CRLF & _ '6|0.2876|0.0026' & @CRLF & _ '7|0.3131|0.0021' & @CRLF & _ '8|0.3337|0.0023' & @CRLF & _ '9|0.3563|0.0024' & @CRLF & _ '10|0.3803|0.0027' & @CRLF & _ '11|0.4071|0.0032' & @CRLF & _ '12|0.4387|0.0037' & @CRLF & _ '13|0.4758|0.0044' & @CRLF & _ '14|0.5197|0.005' & @CRLF & _ '15|0.5693|0.0051' & @CRLF & _ '16|0.6202|0.0055' & @CRLF & _ '17|0.6751|0.0057' & @CRLF & _ '18|0.7322|0.006' & @CRLF & _ '19|0.7923|0.0062' & @CRLF & _ '20|0.8545|0.0065' & @CRLF & _ '21|0.9197|0.0065' & @CRLF & _ '22|0.9846|0.0062' & @CRLF & _ '23|1.0462|0.0064' & @CRLF & _ '24|1.1106|0.0066' & @CRLF & _ '25|1.1767|0.0069' & @CRLF & _ '26|1.2452|0.007' & @CRLF & _ '27|1.3148|0.0071' & @CRLF & _ '28|1.3863|0.0074' & @CRLF & _ '29|1.4605|0.0073' & @CRLF & _ '30|1.5334|0.0074' & @CRLF & _ '31|1.6071|0.0078' & @CRLF & _ '32|1.6847|0.0078' & @CRLF & _ '33|1.7628|0.0079' & @CRLF & _ '34|1.8418|0.008' & @CRLF & _ '35|1.9222|0.0082' & @CRLF & _ '36|2.0045|0.0083' & @CRLF & _ '37|2.0874|0.0083' & @CRLF & _ '38|2.1708|0.0084' & @CRLF & _ '39|2.2553|0.0086' & @CRLF & _ '40|2.3411|0.0088' & @CRLF & _ '41|2.4293|0.0086' & @CRLF & _ '42|2.5157|0.0089' & @CRLF & _ '43|2.6045|0.009' & @CRLF & _ '44|2.6944|0.0092' & @CRLF & _ '45|2.786|0.0092' & @CRLF & _ '46|2.8776|0.0094' & @CRLF & _ '47|2.9716|0.0093' & @CRLF & _ '48|3.0642|0.0093' & @CRLF & _ '49|3.1574|0.0094' & @CRLF & _ '50|3.2512|0.0095' & @CRLF & _ '51|3.346|0.0096' & @CRLF & _ '52|3.4425|0.0099' & @CRLF & _ '53|3.5413|0.0097' & @CRLF & _ '54|3.6387|0.01' & @CRLF & _ '55|3.739|0.0099' & @CRLF & _ '56|3.8383|0.0098' & @CRLF & _ '57|3.9364|0.0101' & @CRLF & _ '58|4.0377|0.0101' & @CRLF & _ '59|4.1387|0.0101' & @CRLF & _ '60|4.2394|0.01' & @CRLF & _ '61|4.3394|0.0099' & @CRLF & _ '62|4.4384|0.0103' & @CRLF & _ '63|4.5411|0.0103' & @CRLF & _ '64|4.6443|0.0104' & @CRLF & _ '65|4.7481|0.0105' & @CRLF & _ '66|4.8528|0.0106' & @CRLF & _ '67|4.959|0.0108' & @CRLF & _ '68|5.0673|0.0106' & @CRLF & _ '69|5.1737|0.0109' & @CRLF & _ '70|5.2824|0.0107' & @CRLF & _ '71|5.3895|0.011' & @CRLF & _ '72|5.4991|0.0108' & @CRLF & _ '73|5.6075|0.0112' & @CRLF & _ '74|5.7193|0.0112' & @CRLF & _ '75|5.8308|0.0111' & @CRLF & _ '76|5.9422|0.0111' & @CRLF & _ '77|6.0531|0.011' & @CRLF & _ '78|6.1635|0.011' & @CRLF & _ '79|6.273|0.0113' & @CRLF & _ '80|6.3864|0.0114' & @CRLF & _ '81|6.5004|0.0115' & @CRLF & _ '82|6.6154|0.0117' & @CRLF & _ '83|6.732|0.0114' & @CRLF & _ '84|6.8457|0.0115' & @CRLF & _ '85|6.9602|0.0116' & @CRLF & _ '86|7.0759|0.0117' & @CRLF & _ '87|7.1933|0.0115' & @CRLF & _ '88|7.3085|0.0117' & @CRLF & _ '89|7.4251|0.0119' & @CRLF & _ '90|7.544|0.0117' & @CRLF & _ '91|7.6612|0.012' & @CRLF & _ '92|7.7811|0.0119' & @CRLF & _ '93|7.8998|0.0117' & @CRLF & _ '94|8.0168|0.0119' & @CRLF & _ '95|8.136|0.0118' & @CRLF & _ '96|8.2539|0.0121' & @CRLF & _ '97|8.3746|0.012' & @CRLF & _ '98|8.4946|0.0119' & @CRLF & _ '99|8.6135|0.0122' & @CRLF & _ '100|8.7358|0.0122' & @CRLF & _ '101|8.858|0.0122' & @CRLF & _ '102|8.9802|0.0122' & @CRLF & _ '103|9.1025|0.0122' & @CRLF & _ '104|9.2247|0.0122' & @CRLF & _ '105|9.347|0.0122' & @CRLF & _ '106|9.4693|0.0122' & @CRLF & _ '107|9.5917|0.0122' & @CRLF & _ '108|9.714|0.0122' & @CRLF & _ '109|9.8364|0.0123' & @CRLF & _ '110|9.959|0.0123' & @CRLF & _ '111|10.0816|0.0123' & @CRLF & _ '112|10.2045|0.0123' & @CRLF & _ '113|10.3278|0.0124' & @CRLF & _ '114|10.4514|0.0124' & @CRLF & _ '115|10.5758|0.0126' & @CRLF & _ '116|10.7013|0.0127' & @CRLF & _ '117|10.8284|0.0124' & @CRLF & _ '118|10.9529|0.0126' & @CRLF & _ '119|11.0785|0.0127' & @CRLF & _ '120|11.2059|0.0125' & @CRLF & _ '121|11.3305|0.0126' & @CRLF & _ '122|11.4564|0.0123' & @CRLF & _ '123|11.5791|0.0128' & @CRLF & _ '124|11.7071|0.0126' & @CRLF & _ '125|11.8329|0.0128' & @CRLF & _ '126|11.9605|0.0125' & @CRLF & _ '127|12.0856|0.0127' & @CRLF & _ '128|12.2121|0.0129' & @CRLF & _ '129|12.3408|0.0127' & @CRLF & _ '130|12.4676|0.0129' & @CRLF & _ '131|12.5966|0.0127' & @CRLF & _ '132|12.7241|0.013' & @CRLF & _ '133|12.8541|0.0129' & @CRLF & _ '134|12.9829|0.0127' & @CRLF & _ '135|13.1099|0.0129' & @CRLF & _ '136|13.2393|0.0128' & @CRLF & _ '137|13.3673|0.0126' & @CRLF & _ '138|13.4929|0.0127' & @CRLF & _ '139|13.6202|0.013' & @CRLF & _ '140|13.7501|0.0129' & @CRLF & _ '141|13.8786|0.0127' & @CRLF & _ '142|14.0053|0.0129' & @CRLF & _ '143|14.1343|0.0127' & @CRLF & _ '144|14.2615|0.013' & @CRLF & _ '145|14.3912|0.0128' & @CRLF & _ '146|14.5196|0.0126' & @CRLF & _ '147|14.6458|0.0128' & @CRLF & _ '148|14.774|0.0126' & @CRLF & _ '149|14.9002|0.0128' & @CRLF & _ '150|15.0284|0.0126' & @CRLF & _ '151|15.1544|0.0128' & @CRLF & _ '152|15.2823|0.0126' & @CRLF & _ '153|15.408|0.0127' & @CRLF & _ '154|15.5353|0.0125' & @CRLF & _ '155|15.6602|0.0126' & @CRLF & _ '156|15.7863|0.0128' & @CRLF & _ '157|15.9145|0.0131' & @CRLF & _ '158|16.0455|0.013' & @CRLF & _ '159|16.1759|0.0124' & @CRLF & _ '160|16.3|0.0125' & @CRLF & _ '161|16.4252|0.0127' & @CRLF & _ '162|16.5518|0.0124' & @CRLF & _ '163|16.6756|0.0124' & @CRLF & _ '164|16.8001|0.0121' & @CRLF & _ '165|16.9206|0.012' & @CRLF & _ '166|17.0403|0.0123' & @CRLF & _ '167|17.1637|0.0124' & @CRLF & _ '168|17.2878|0.0125' & @CRLF & _ '169|17.4128|0.0121' & @CRLF & _ '170|17.5341|0.0121' & @CRLF & _ '171|17.6549|0.012' & @CRLF & _ '172|17.7751|0.0124' & @CRLF & _ '173|17.8994|0.012' & @CRLF & _ '174|18.0196|0.0119' & @CRLF & _ '175|18.1387|0.0123' & @CRLF & _ '176|18.2613|0.0123' & @CRLF & _ '177|18.3841|0.0123' & @CRLF & _ '178|18.5073|0.0124' & @CRLF & _ '179|18.631|0.0119' & @CRLF & _ '180|18.7501|0.0118' & @CRLF & _ '181|18.8679|0.0121' & @CRLF & _ '182|18.9885|0.012' & @CRLF & _ '183|19.1083|0.0119' & @CRLF & _ '184|19.2268|0.0117' & @CRLF & _ '185|19.3435|0.0119' & @CRLF & _ '186|19.4624|0.0117' & @CRLF & _ '187|19.5798|0.0115' & @CRLF & _ '188|19.6947|0.0116' & @CRLF & _ '189|19.811|0.0118' & @CRLF & _ '190|19.9295|0.0117' & @CRLF & _ '191|20.046|0.0114' & @CRLF & _ '192|20.1598|0.0115' & @CRLF & _ '193|20.2744|0.0116' & @CRLF & _ '194|20.3903|0.0113' & @CRLF & _ '195|20.5029|0.0113' & @CRLF & _ '196|20.616|0.0114' & @CRLF & _ '197|20.7296|0.0114' & @CRLF & _ '198|20.8439|0.0115' & @CRLF & _ '199|20.9593|0.0112' & @CRLF & _ '200|21.0713|0.0112' & @CRLF & _ '201|21.1833|0.0112' & @CRLF & _ '202|21.2952|0.0112' & @CRLF & _ '203|21.407|0.0112' & @CRLF & _ '204|21.5189|0.0112' & @CRLF & _ '205|21.6306|0.0112' & @CRLF & _ '206|21.7422|0.0111' & @CRLF & _ '207|21.8535|0.0111' & @CRLF & _ '208|21.9644|0.011' & @CRLF & _ '209|22.0748|0.0104' & @CRLF & _ '210|22.1792|0.0106' & @CRLF & _ '211|22.285|0.0103' & @CRLF & _ '212|22.3875|0.0103' & @CRLF & _ '213|22.4904|0.0103' & @CRLF & _ '214|22.5938|0.0104' & @CRLF & _ '215|22.698|0.01' & @CRLF & _ '216|22.7982|0.01' & @CRLF & _ '217|22.8977|0.0103' & @CRLF & _ '218|23.0011|0.0099' & @CRLF & _ '219|23.1001|0.0098' & @CRLF & _ '220|23.1977|0.0101' & @CRLF & _ '221|23.2982|0.01' & @CRLF & _ '222|23.3982|0.0099' & @CRLF & _ '223|23.4972|0.0097' & @CRLF & _ '224|23.5947|0.0095' & @CRLF & _ '225|23.69|0.0097' & @CRLF & _ '226|23.7872|0.0095' & @CRLF & _ '227|23.882|0.0094' & @CRLF & _ '228|23.9759|0.0092' & @CRLF & _ '229|24.0684|0.0093' & @CRLF & _ '230|24.1612|0.0093' & @CRLF & _ '231|24.2546|0.0089' & @CRLF & _ '232|24.3438|0.009' & @CRLF & _ '233|24.4343|0.009' & @CRLF & _ '234|24.5241|0.0089' & @CRLF & _ '235|24.613|0.0087' & @CRLF & _ '236|24.6997|0.0088' & @CRLF & _ '237|24.7874|0.0086' & @CRLF & _ '238|24.8731|0.0085' & @CRLF & _ '239|24.9582|0.0084' & @CRLF & _ '240|25.0426|0.0081' & @CRLF & _ '241|25.1235|0.0081' & @CRLF & _ '242|25.2041|0.008' & @CRLF & _ '243|25.2841|0.0079' & @CRLF & _ '244|25.3636|0.0078' & @CRLF & _ '245|25.442|0.0077' & @CRLF & _ '246|25.5188|0.0077' & @CRLF & _ '247|25.5958|0.0077' & @CRLF & _ '248|25.6732|0.0071' & @CRLF & _ '249|25.7444|0.0071' & @CRLF & _ '250|25.8154|0.0071' & @CRLF & _ '251|25.8862|0.0069' & @CRLF & _ '252|25.9548|0.0069' & @CRLF & _ '253|26.0239|0.0068' & @CRLF & _ '254|26.092|0.0067' & @CRLF & _ '255|26.1585|0.0064' & @CRLF & _ '256|26.2225|0.0063' & @CRLF & _ '257|26.2855|0.0061' & @CRLF & _ '258|26.3468|0.0062' & @CRLF & _ '259|26.4083|0.0062' & @CRLF & _ '260|26.47|0.0059' & @CRLF & _ '261|26.5295|0.0056'
- 13 replies
-
In the autoit file, if we add multiple libraries (both internal and custom created one) When we compile the code and run the exe, some time we are getting runtime errors. But the line number of error is not showing the exact line number, might be it is including the line number count of libraries also. Can you please suggest how to get the exact error line number. So, it will be useful for debugging.
-
Hi, I've a script, using WinAPIGdi, checking info on font files for some files, I get the error "C:\DEV\AutoIt3\Include\WinAPIGdi.au3" (2480) : ==> Variable must be of type "Object".: and then the script stops. Is there a way I can either "catch" that error, and let my script continue with the next file or improve something in the WinAPIGdi script? I've searched the forums on error handling, but couldn't immediately find something related tho errors like these which are hardstopping the script P.S. : I'm an AutoIT script newbie..... snippet from WinAPIGdi, line 2480 from the error is this one: $sResult = $tResult.szTTFName ; #FUNCTION# ==================================================================================================================== ; Author ........: funkey ; Modified ......: UEZ, jpm ; =============================================================================================================================== Func _WinAPI_GetFontMemoryResourceInfo($pMemory, $iFlag = 1) Local Const $tagTT_OFFSET_TABLE = "USHORT uMajorVersion;USHORT uMinorVersion;USHORT uNumOfTables;USHORT uSearchRange;USHORT uEntrySelector;USHORT uRangeShift" Local Const $tagTT_TABLE_DIRECTORY = "char szTag[4];ULONG uCheckSum;ULONG uOffset;ULONG uLength" Local Const $tagTT_NAME_TABLE_HEADER = "USHORT uFSelector;USHORT uNRCount;USHORT uStorageOffset" Local Const $tagTT_NAME_RECORD = "USHORT uPlatformID;USHORT uEncodingID;USHORT uLanguageID;USHORT uNameID;USHORT uStringLength;USHORT uStringOffset" Local $tTTOffsetTable = DllStructCreate($tagTT_OFFSET_TABLE, $pMemory) Local $iNumOfTables = _WinAPI_SwapWord(DllStructGetData($tTTOffsetTable, "uNumOfTables")) ;check is this is a true type font and the version is 1.0 If Not (_WinAPI_SwapWord(DllStructGetData($tTTOffsetTable, "uMajorVersion")) = 1 And _WinAPI_SwapWord(DllStructGetData($tTTOffsetTable, "uMinorVersion")) = 0) Then Return SetError(1, 0, "") Local $iTblDirSize = DllStructGetSize(DllStructCreate($tagTT_TABLE_DIRECTORY)) Local $bFound = False, $iOffset, $tTblDir For $i = 0 To $iNumOfTables - 1 $tTblDir = DllStructCreate($tagTT_TABLE_DIRECTORY, $pMemory + DllStructGetSize($tTTOffsetTable) + $i * $iTblDirSize) If StringLeft(DllStructGetData($tTblDir, "szTag"), 4) = "name" Then $bFound = True $iOffset = _WinAPI_SwapDWord(DllStructGetData($tTblDir, "uOffset")) ExitLoop EndIf Next If Not $bFound Then Return SetError(2, 0, "") Local $tNTHeader = DllStructCreate($tagTT_NAME_TABLE_HEADER, $pMemory + $iOffset) Local $iNTHeaderSize = DllStructGetSize($tNTHeader) Local $iNRCount = _WinAPI_SwapWord(DllStructGetData($tNTHeader, "uNRCount")) Local $iStorageOffset = _WinAPI_SwapWord(DllStructGetData($tNTHeader, "uStorageOffset")) Local $iTTRecordSize = DllStructGetSize(DllStructCreate($tagTT_NAME_RECORD)) Local $tResult, $sResult, $iStringLength, $iStringOffset, $iEncodingID, $tTTRecord For $i = 0 To $iNRCount - 1 $tTTRecord = DllStructCreate($tagTT_NAME_RECORD, $pMemory + $iOffset + $iNTHeaderSize + $i * $iTTRecordSize) If _WinAPI_SwapWord($tTTRecord.uNameID) = $iFlag Then ;1 says that this is font name. 0 for example determines copyright info $iStringLength = _WinAPI_SwapWord(DllStructGetData($tTTRecord, "uStringLength")) $iStringOffset = _WinAPI_SwapWord(DllStructGetData($tTTRecord, "uStringOffset")) $iEncodingID = _WinAPI_SwapWord(DllStructGetData($tTTRecord, "uEncodingID")) Local $sWchar = "char" If $iEncodingID = 1 Then $sWchar = "word" $iStringLength = $iStringLength / 2 EndIf $tResult = DllStructCreate($sWchar & " szTTFName[" & $iStringLength & "]", $pMemory + $iOffset + $iStringOffset + $iStorageOffset) If $iEncodingID = 1 Then $sResult = "" For $j = 1 To $iStringLength $sResult &= ChrW(_WinAPI_SwapWord(DllStructGetData($tResult, 1, $j))) Next Else $sResult = $tResult.szTTFName EndIf If StringLen($sResult) > 0 Then ExitLoop EndIf Next Return $sResult EndFunc ;==>_WinAPI_GetFontMemoryResourceInfo the function in my script: Func FontGetInfoFromFile($sFile, $n, $sElement) Local $s = _WinAPI_GetFontResourceInfo($sFile, Default, $n) If Not @error And $s Then ConsoleWrite($sElement & " = " & $s & @CRLF) If @error Then ConsoleWrite ("ERROR!!!") EndFunc ;==>FontGetInfoFromFile and _WinAPI_GetFontResourceInfo uses _WinAPI_GetFontMemoryResourceInfo as you know any help or hints are welcome Babylon5.ttf Bahamas.ttf
-
What is Rollbar? Rollbar provides real-time error alerting & debugging tools for developers. Learn more about it at https://rollbar.com/product/ Demo: https://rollbar.com/demo/demo/ Screenshot: Instructions: (RollbarTest.au3) ; Include RollbarSDK #include "RollbarSDK.au3" ;Turns on ConsoleWrite debugging override. ;Global $Rollbar_Debug=False ; Initialize RollbarSDK with the project's API key. ; Parameters ....: $__Rollbar_sToken - [Required] Go to https://rollbar.com/<User>/<ProjectName>/settings/access_tokens/ for your project. Use the token for post_server_item. _Rollbar_Init("eaa8464a4082eeabd9454465b8f0c0af") ; Write code that causes an error you want to catch, then call ; _Rollbar_Send ; Parameters ....: $__Rollbar_sErrorLevel - [Required] Must be one of the following values: Debug, Info, Warning, Error, Critical. ; $__Rollbar_sMessage - [Required] The message to be sent. This should contain any useful debugging info that will help you debug. ; $__Rollbar_sMessageSummary - [Optional] A string that will be used as the title of the Item occurrences will be grouped into. Max length 255 characters. If omitted, Rollbar will determine this on the backend. _Rollbar_Send("Debug", "This is an debug message. If you received this, you were successful!", "Debug Message") _Rollbar_Send("Info", "This is a test message. If you received this, you were successful!", "Info Message") _Rollbar_Send("Warning", "This is an warning message. If you received this, you were successful!", "Warning Message") _Rollbar_Send("Error", "This is an error message. If you received this, you were successful!", "Error Message") _Rollbar_Send("Critical", "This is an critical message. If you received this, you were successful!", "Critical Message") _Rollbar_Send("Info", "This is a test message. If you received this, you were successful!") ;No Message ; Rollbar_Send's helper functions ; Parameters ....: $__Rollbar_sMessage - [Required] The message to be sent. This should contain any useful debugging info that will help you debug. ; $__Rollbar_sMessageSummary - [Optional] A string that will be used as the title of the Item occurrences will be grouped into. Max length 255 characters. If omitted, Rollbar will determine this on the backend. _Rollbar_SendDebug("This is an debug message. If you received this, you were successful!", "Debug Message") _Rollbar_SendInfo("This is a test message. If you received this, you were successful!", "Info Message") _Rollbar_SendWarning("This is an warning message. If you received this, you were successful!", "Warning Message") _Rollbar_SendError("This is an error message. If you received this, you were successful!", "Error Message") _Rollbar_SendCritical("This is an critical message. If you received this, you were successful!", "Critical Message") ; Usable Example Local $sImportantFile = "C:\NOTAREALFILE_1234554321.txt" Switch FileExists($sImportantFile) Case True MsgBox(0, "Example Script", "An important file was found. Continuing...") Case Else _Rollbar_SendCritical('An important file was missing. Halting... File: "' & $sImportantFile & '"', 'Important file "' & $sImportantFile & '" is missing.') EndSwitch Notes: Please comment your feedback, advice, & suggestions below. While this is only a proof of concept, I will expand its feature set for everyone to use. Right now, it is fully functional but not tested in production. Changelog: RollbarSDK.au3 RollbarTest.au3 v0.2 v0.1.1
-
Hi Folks Can not get my head around this one. This function gets the DNS object s If you have two DNS entries fine. but if you have only one! Trouble $objItem.DNSServerSearchOrder[0] = Primary DNS $objItem.DNSServerSearchOrder[1] = Secondry DNS not always there. I need a way to return 0 if not there or the IP if its there. Or is there a way to tell how many objects there are in the "[?]" I'm terrible at WMI errors, thanks for help in advance. Func _GETcurrentNICinfo2() $oErrors = ObjEvent("AutoIt.Error", "Error_Handle") Local $DnsSecondry Local $objWMIService = ObjGet( "winmgmts:\\" & @ComputerName & "\root\CIMV2" ) Local $query = $objWMIService.ExecQuery("SELECT DNSServerSearchOrder FROM Win32_NetworkAdapterConfiguration WHERE Index = " & _GetSelectedNIC(), "WQL", 0x30 ) If @error Then Return 0 If NOT IsObj($query) Then Return 0 Else For $objItem In $query Return $objItem.DNSServerSearchOrder[1] next Endif EndFunc
-
Hey, guys. Currently, I'm using Opencv UDF and i'm encountering issues with DLLOPEN(). it is failing and returning -1 But, I cannot figure out why it is failing. I need help from people. I'm running windows 10 32bit. This's my code. #RequireAdmin $fileopen = DllOpen("opencv_core2413.dll") MsgBox(0,"Result",$fileopen) Example.au3opencv_core2413.dll
-
This script used to work on an older version of AutoIT. Currently I am running AutoIT v3.3.14.5 and it's failing. Func PublicIP() ;Post public facing IP address Local $url = 'https://www.google.com/search?client=opera&q=what+is+my+ip&sourceid=opera&ie=UTF-8&oe=UTF-8' Local $getIPaddress = BinaryToString(InetRead($url)) Local $sStart = 'clamp:2">' Local $sEnd = '</div>' Local $ipaddress = _StringBetween($getIPaddress, $sStart, $sEnd For $i In $ipaddress MsgBox(0, 'External IP', "Your public IP address is " & $i) Next EndFunc ;==>PublicIP The console output shows: "C:\Users\user\Documents\AutoIT\Scripts\WSI Tools.au3" (197) : ==> Variable must be of type "Object".: For $i In $ipaddress For $i In $ipaddress^ ERROR ->14:12:16 AutoIt3.exe ended.rc:1 +>14:12:16 AutoIt3Wrapper Finished. >Exit code: 1 Time: 9.811
-
I'm listing the error message strings, and roughly matching the error code Is this how to do error reporting? Is there a more simple way I don't know about? I realise I might not need to trap @error inside $error. I like it this way b/c I have no fear of overwriting @error now; I don't even use it. Func Send_Connect($address, $port) $socket = TCPConnect($address, $port) $error = @error If $error <> 0 Then Local $aError[4] = ["-2 not connected.", _ "1 IPAddr is incorrect.", _ "2 port is incorrect."] $aError[3] = "10060 Connection timed out." If $error < 0 Then $error = 0 If $error > 2 Then $error = 3 MsgBox(0, "TCP Connect Error", $aError[$error], 0) $socket = 0 EndIf Return $socket EndFunc
-
Hi everyone, I am wondering if is there any autoit function that make the program ignore errors and move on and resume correct lines? Thank you
-
Hello, I'm trying to make a program that can look at a folder directory, find all the CSV files, and then add the data from CSV's to an array. The problem I seem to be running into is on the 2nd iteration (2nd file) when the script will not create an array. Could someone please help? Thanks in advance #include <Array.au3> #include <File.au3> #include <MsgBoxConstants.au3> #include <Excel.au3> #include <MsgBoxConstants.au3> Global $MasterArray RefineData() Func RefineData() Local $i, $filenum, $file, $csvArray, $sFilePath = @ScriptDir $fileList = _FileListToArrayRec($sFilePath, "*.csv", 1) ;Create and array of all .csv files within folder ;=====Loop through the .csv files within the folder====== For $filenum = 1 To UBound($fileList) - 1 Step 1 $file = $fileList[$filenum] $sFilePath = $sFilePath & "\" & $file ;=====Create array based on csv file===== _FileReadToArray($sFilePath, $csvArray, $FRTA_NOCOUNT, ",") _ArrayDisplay($csvArray,"File: " & $filenum) If $filenum = 1 Then $MasterArray = $csvArray _ArrayDisplay($MasterArray, "Master") Else $MasterArray = _ArrayColInsert($MasterArray, UBound($MasterArray)) ;want column added at end For $i = 0 To UBound($MasterArray)-1 Step 1 $MasterArray[$i][UBound($MasterArray) - 1] = $csvArray[$i][4] Next _ArrayDisplay($MasterArray, "Master") EndIf Next EndFunc ;==>RefineData
-
Hi dear I have a question please Can we customize error messages in autoit script? I mean internal error messages for example AutoIt Error Line 4 (File "D:\my projects\NVDA Manager\New AutoIt v3 Script.au3"): $script[1] = 1 $script^ ERROR Error: Subscript used on non-accessible variable. For example, I want to customize this message Is this possible? am waiting for your answers
-
i have seen many pointing out issues related to this, i tried reading through them - still unable to solve mine.. i have a script which reads certain lines based on a search item, this is an iterative process - the ldflst_file gets updated for each iteration and the script finds the line number which has the search item. this works perfectly for few iterations, but stops in some cases abruptly with the error = Subscript used on non-accessible variable $aRead^ ERROR I have verified that the search item is present in the file. what could be the reason for this code to stop in certain cases. thanks for help my code below (partial).. full code is in attachment local $aRead=FileReadToArray($ldflst_file) global $ldflst_var1=" JOINT LOAD FORCE(X) FORCE(Y) FORCE(Z) MOMENT(X) MOMENT(Y) MOMENT(Z)" for $i= 0 to $ldflst_totlines ; ldflst_totlines is total number of lines in the file 'ldflst_file' if $aRead[$i]=$ldflst_var1 Then $ldflst_LFound=$i ExitLoop else EndIf Next nomo_new1.au3
-
Hi all, Long time lurker and now forum poster! I'm writing a relatively simple backup script for my firm that automates the copy, compression and organization of Leaver's data on one of our secured NAS systems. I personally found the best method to do this so far was to use 7zG.exe (GUI version of 7Zip which can use command-line too) and it functions quite well! I would like to retrieve more info on whether any warnings or errors happen in 7Zip during the backup, but I can't quite get my head around the syntax and switches for reading out, it seems any adjustment I make to the RunWait call's string seems to break the backup or give unexpected repercussions! Hopefully its something silly I'm doing as I don't code very often. Here is the working version: ; Compress the directories one by one in the zip using the listfile.... Local $iPID = RunWait(@ScriptDir & "\bin\7zG.exe a -mx" & $compressionQuality & " -v" & $compressSplitFileSize & " -wc:\temp " _ & $backupToLocation & "\" & $userDirectory & ".7z @bin\listfile.txt -x@bin\excludefile.txt", "", @SW_SHOWDEFAULT, $STDOUT_CHILD) Ultimately I would love to switch entirely to 7za.exe (standalone) so that I can read the progress percentage, current file being uploaded and any warnings or errors could be processed and output to the AutoIT script's GUI I've created rather than jumping in and out of two applications per se.
- 2 replies
-
- 7zip
- commandline
-
(and 3 more)
Tagged with:
-
Hey I searched code on autoit forum and modify it according to my needs and try to translate text from Russian to English in return I'm getting error such as "Error 411 (Length Required)!!1" Both my autoit codes and error I got are given below, please help me to solve this issue, Thanks Autoit codes to translate text form Russian to English; #include <urlencode.au3> $File1 = @ScriptDir & "\russian_text.txt" $txt = FileRead($File1) ; Try to convert line breaks with .....so final URL looks simpler $txt = StringReplace($txt, @CRLF, '...........') $txt = StringReplace($txt, @LF, '.............') $txt = StringReplace($txt, @CR, '.............') FileWrite (@scriptdir & '\russian_text2.txt', $txt) $openfile = @ScriptDir & "\russian_text2.txt" $mytext = FileRead ($openfile) $encoding = urlencode ($mytext) FileWrite (@scriptdir & '\enooding.txt', $encoding) $from = "ru" $to = "en" $url = "https://translate.googleapis.com/translate_a/single?client=gtx" $url &= "&sl=" & $from & "&tl=" & $to & "&dt=t&q=" & $encoding $oHTTP = ObjCreate("Microsoft.XMLHTTP") $oHTTP.Open("POST", $url, False) $oHTTP.Send() $sData = $oHTTP.ResponseText $sData = StringRegExpReplace($sData, '.*?\["(.*?)(?<!\\)"[^\[]*', "$1" & @crlf) FileWrite (@scriptdir & '\errorcode.txt', $sData) Msgbox(0,"", $sData) In response of above codes, I'm getting below error; <!DOCTYPE html> <html lang=en> <meta charset=utf-8> <meta name=viewport content="initial-scale=1, minimum-scale=1, width=device-width"> <title>Error 411 (Length Required)!!1</title> <style> *{margin:0;padding:0}html,code{font:15px/22px arial,sans-serif}html{background:#fff;color:#222;padding:15px}body{margin:7% auto 0;max-width:390px;min-height:180px;padding:30px 0 15px}* > body{background:url(//www.google.com/images/errors/robot.png) 100% 5px no-repeat;padding-right:205px}p{margin:11px 0 22px;overflow:hidden}ins{color:#777;text-decoration:none}a img{border:0}@media screen and (max-width:772px){body{background:none;margin-top:0;max-width:none;padding-right:0}}#logo{background:url(//www.google.com/images/branding/googlelogo/1x/googlelogo_color_150x54dp.png) no-repeat;margin-left:-5px}@media only screen and (min-resolution:192dpi){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat 0% 0%/100% 100%;-moz-border-image:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) 0}}@media only screen and (-webkit-min-device-pixel-ratio:2){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat;-webkit-background-size:100% 100%}}#logo{display:inline-block;height:54px;width:150px} </style> <a href=//www.google.com/><span id=logo aria-label=Google></span></a> <p><b>411.</b> <ins>That’s an error.</ins> <p>POST requests require a <code>Content-length</code> header. <ins>That’s all we know.</ins>
- 10 replies
-
- translator
-
(and 3 more)
Tagged with:
-
Hi all, I have a bit of code that works on my old Win10 PC, that fails on my new Win10 PC, and I think the only significant difference is the version of Autoit - old PC has 3.3.12, new has 3.3.14. I couldn't find anything mentioned in the change logs though, so perhaps I'm wrong. Anyway, the code to replicate my issue is: Test('username', 'DOMAIN') ; THIS ERRORS: ;Test('localun', 'DOMAIN') ; THIS ERRORS: ;Test(' ', ' ') ; THIS ERRORS: ;Test('', '') ; THIS ERRORS: ;Test('localun', '') ; THIS ERRORS: ;Test('', 'DOMAIN') Func Test($un, $dom) $compName = 'PCNAME' $FullName = '.' $Description = '.' ; get the WIM object $objWMIService = ObjGet("winmgmts:\\" & $compName & "\root\cimv2") ; get default user full name and description $objAccount = $objWMIService.Get("Win32_UserAccount.Name='" & $un & "',Domain='" & $dom & "'") If IsObj($objAccount) Then $FullName = $objAccount.FullName $Description = $objAccount.Description EndIf ConsoleWrite($FullName & @CRLF) ConsoleWrite($Description & @CRLF) Return EndFunc On my old PC this code will output just . and . for each of those line currently commented out. Which is fine. On my new PC any of those commented out lines of code cause an error, and the script won't even compile. $objAccount = $objWMIService.Get("Win32_UserAccount.Name='" & $un & "',Domain='" & $dom & "'") $objAccount = $objWMIService^ ERROR I'm very much a newb with the WMI stuff and objects, but it looks like the .Get property is failing when either $un or $dom aren't valid in v3.3.14, whereas in 3.3.12 the .Get would fail to return an object, which is then caught by the If statement. Am I on track with this? Is there some new/better way to code the example so that 3.3.14 will compile it?
-
-
I get this error, Whenever I try to find a date. Does anyone have any idea why? I saw some post from 2015, However I would imagine this is fixed by now. @water >"J:\Temporary Files\XXXXXXXXX\AutoIt\AutoIt\AutoIt\SciTe\..\autoit3.exe" /ErrorStdOut "C:\Users\XXXXXX\Desktop\Call Report Automation.au3" "J:\Temporary Files\XXXXXXXX\AutoIt\AutoIt\AutoIt\Include\Excel.au3" (656) : ==> The requested action with this object has failed.: $aResult[$iIndex][1] = $oMatch.Name.Name $aResult[$iIndex][1] = $oMatch^ ERROR >Exit code: 1 Time: 5.791 #include <Excel.au3> Global $sExcelFile1 = FileOpenDialog("Choose/Create Excel File", @ScriptDir, "(*.xlsm)") Global $sExcelFile2 = FileOpenDialog("Choose/Create Excel File", @ScriptDir, "Excel Sheet (*.xlsx;*.xls)|All (*.*)") If FileExists($sExcelFile2) Then Global $oExcel2 = _Excel_Open () $oExcel2 = _Excel_BookOpen($oExcel2,$sExcelFile2) EndIF If FileExists($sExcelFile1) Then Global $oExcel1 = _Excel_Open () $oExcel1 = _Excel_BookOpen($oExcel1,$sExcelFile1,Default,Default,"2007") EndIF $oRead = _Excel_RangeRead ($oExcel2,Default,"A2",3) _Excel_RangeWrite ($oExcel1,"Calls Handled",$oRead,"BY7") Sleep (1000) _Excel_RangeFind ($oExcel1,$oRead,"E4:FD92") MsgBox (0,"Test",$oRead) UPDATE: If I take out this line it works. By works I mean I don't get the error. :/ However, I need it. I am just confused. _Excel_RangeWrite ($oExcel1,"Calls Handled",$oRead,"BY7") UPDATE 2: I also get this error when trying to use the helpfile examples. I have version 3.3.14.2 \AutoIt\AutoIt\AutoIt\Include\Excel.au3" (670) : ==> The requested action with this object has failed.: $oSheet = $oWorkbook.Sheets($iIndexSheets) $oSheet = $oWorkbook^ ERROR >Exit code: 1 Time: 0.8931
-
How would I go about writing a IF Then statement if the conrol send fails? Run ("Notepad.exe") WinWaitActive ("Untitled - Notepad") ControlSend("Untitled - Notepad", "", "Edit1", ("Provider Practice Record")) I have been running into lag alot. So my script has been missing input. I would like to be able to have it retry to put in "Provider Practice Record" if it misses. I am assuming a if then statement is what I need but I am not sure what ControlSend will return if it tries to send to Edit1 and it is not there. Or do I need to just add a timeout?
-
Hello all, I'm trying to create a webscrape script using AutoIt. A non-profit I'm involved with is using GroupSpaces.com and there is no notification to the group when someone posts a new topic to the forum. I'm including IE.au3 #include <MsgBoxConstants.au3> #include <Array.au3> #include <String.au3> ; Open Groupspaces.com Global $oIE = _IECreate ("http://www.groupspaces.com") _IENavigate($oIE,"http://groupspaces.com/MyCrazyTest/forum/") ;Grab all the links on the Forum page Global $oLinksCategoryPage = _IELinkGetCollection($oIE) For $oLink In $oLinksCategoryPage Local $oLinkHRef = $oLink.href If StringInStr($oLinkHRef,"forum_id") Then ;This is a category. Click into it. _IENavigate($oIE,$oLinkHRef) Sleep(3) ;Back out to Category List _IEAction($oIE,"back") EndIf Next _IEQuit($oIE)