Jump to content

Ignone error


Go to solution Solved by jdelaney,

Recommended Posts

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

  • Moderators

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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

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 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

  • Moderators

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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

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 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

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.

Link to comment
Share on other sites

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 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

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

 

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.

Link to comment
Share on other sites

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 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

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!

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...