francys Posted June 14, 2013 Share Posted June 14, 2013 My simple code Sleep(5000) MsgBox(1,"aaa","aaa" Sleep(3000) MsgBox(1,"bbb","bbb") Sleep(3000) MsgBox(1,"ccc","ccc") Sleep(3000) Note that the above code has an error because missing parentheses. I need the autoit to ignore the error and exit. Help me. Link to comment Share on other sites More sharing options...
Mat Posted June 14, 2013 Share Posted June 14, 2013 By ignore the error you mean not show the message box? Look at the /ErrorStdout command line option for autoit. AutoIt Project Listing Link to comment Share on other sites More sharing options...
francys Posted June 14, 2013 Author Share Posted June 14, 2013 When detecting the error the program will be terminated Link to comment Share on other sites More sharing options...
francys Posted June 14, 2013 Author Share Posted June 14, 2013 Have otherwise? without the prompt? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted June 14, 2013 Moderators Share Posted June 14, 2013 francys,Download and install the full SciTE4AutoIt3 package. Then when you run or compile a script, you automatically run a syntax checker which will pick up errors like this for you. That way you can correct them before you run the script live. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
francys Posted June 14, 2013 Author Share Posted June 14, 2013 I do not want to fix the code. I want it to be finalized to find any errors. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted June 14, 2013 Moderators Share Posted June 14, 2013 francys,There is no tool that I know of that will correct the code for you. The tools to which I pointed you will tell that there is an error, what type it is, and where it is in the script - it is then up to you to fix it. After all, it is your code and so you made the error in the first place - so it seems only logical that you are the one to amend it to remove the error. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
jdelaney Posted June 14, 2013 Share Posted June 14, 2013 (edited) And where's my jet-pack! You can create a script to clean up/fix other scripts...seems like a lot of work though Edited June 14, 2013 by jdelaney IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
francys Posted June 14, 2013 Author Share Posted June 14, 2013 Because I have a script much bigger than this and sometimes it works correctly and sometimes the error, not the error code, but in other situations. Continue studying. Thank you. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted June 14, 2013 Moderators Share Posted June 14, 2013 francys,So install the SciTE4AutoIt3 package and run the script from that - then you will be pointed to the very line that caused the problem. Good luck. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
jdelaney Posted June 14, 2013 Share Posted June 14, 2013 (edited) Sounds like syntax is good, if it can run. You need to do error checking, and logging, to see excatly where logic is failing within the run. That way, you can make the piece more fail-proof. Without the actual error, or script, we can't help Edited June 14, 2013 by jdelaney IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
DW1 Posted June 14, 2013 Share Posted June 14, 2013 Correct me if I'm wrong, but I'm gong to attempt to rephrase what you are asking for since it is unclear. Are you asking for a way to just have the application exit with no error message when you run in to a problem due to bad coding, like invalid dimensions of an array? If you are asking for it to ignore the error and keep running, that's not going to be possible, as the error was script breaking. As mentioned above, proper error checking is the right solution, but I'm curious as to exactly what you are looking for as the solution. AutoIt3 Online Help Link to comment Share on other sites More sharing options...
blckpythn Posted June 14, 2013 Share Posted June 14, 2013 Your first MsgBox is missing its last parenthesis...Said none of the above posters. Link to comment Share on other sites More sharing options...
jdelaney Posted June 14, 2013 Share Posted June 14, 2013 (edited) the parenthesis is not the poster's real issue, blckpythn ...the question for the missing parenthesis was rhetorical (at least from my interpretation, explained in post #11) Edited June 14, 2013 by jdelaney IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
francys Posted June 14, 2013 Author Share Posted June 14, 2013 Exactly danwilli "a way to just have the application exit with no error message when you run in to a problem due to bad coding." Thanks for your patience Link to comment Share on other sites More sharing options...
jdelaney Posted June 14, 2013 Share Posted June 14, 2013 well, in his examples of bad subscripts in an array, do error checking like this, so that error does not occur: $array = "" For $i = 0 To UBound($array)-1 ConsoleWrite("you wont see this, and no error, since I validated the array") Next IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
DW1 Posted June 14, 2013 Share Posted June 14, 2013 Exactly danwilli "a way to just have the application exit with no error message when you run in to a problem due to bad coding." Thanks for your patience The first reply to the question actually answers this. By ignore the error you mean not show the message box? Look at the /ErrorStdout command line option for autoit. To expand a little, Mat is saying to call your executable with the "/ErrorStdOut" parameter. I'd bet you next question is if there is a way to force this option from in the script, and I'm not sure on that one, but Mat is correct in saying that this parameter will prevent the message box. AutoIt3 Online Help Link to comment Share on other sites More sharing options...
jdelaney Posted June 14, 2013 Share Posted June 14, 2013 (edited) took some debugging...if you compile your script with this, no message box will display #include <Misc.au3> If _Singleton("test",1) Then MsgBox(1,1,1) ; prove no blow up Run(@ScriptFullPath & " " & "/ErrorStdOut") Sleep(5000) Exit EndIf MsgBox(1,1,2) ; prove about to blow up $array[20] ; this is invalid, and will blowup without the above this will work for exe or au3: #include <Misc.au3> $Autoit = @ProgramFilesDir & "\autoit3\autoit3.exe" If StringRight(@ScriptName,3) = "au3" Then $runcommand = $Autoit & " /ErrorStdOut " & @ScriptFullPath Else $runcommand = @ScriptFullPath & " " & "/ErrorStdOut" EndIf If _Singleton("test",1) Then MsgBox(1,1,1) ; prove no blow up Run($runcommand) Sleep(5000) Exit EndIf MsgBox(1,1,2) ; prove about to blow up $array[20] ; this is invalid, and will blowup without the above Edited June 14, 2013 by jdelaney IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
DW1 Posted June 14, 2013 Share Posted June 14, 2013 took some debugging...if you compile your script with this, no message box will display #include <Misc.au3> If _Singleton("test",1) Then MsgBox(1,1,1) ; prove no blow up Run(@ScriptFullPath & " " & "/ErrorStdOut") Sleep(5000) Exit EndIf MsgBox(1,1,2) ; prove about to blow up $array[20] ; this is invalid, and will blowup without the above this will work for exe or au3: #include <Misc.au3> $Autoit = @ProgramFilesDir & "\autoit3\autoit3.exe" If StringRight(@ScriptName,3) = "au3" Then $runcommand = $Autoit & " /ErrorStdOut " & @ScriptFullPath Else $runcommand = @ScriptFullPath & " " & "/ErrorStdOut" EndIf If _Singleton("test",1) Then MsgBox(1,1,1) ; prove no blow up Run($runcommand) Sleep(5000) Exit EndIf MsgBox(1,1,2) ; prove about to blow up $array[20] ; this is invalid, and will blowup without the above We all know that the real solution is to do proper error checking, but in regards to what the OP was looking for, this looks great, good work! AutoIt3 Online Help Link to comment Share on other sites More sharing options...
jdelaney Posted June 14, 2013 Share Posted June 14, 2013 completely agreed ^ IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
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