Home > Language Reference > System Variables > IgnoreErrors


The #IgnoreErrors system variable controls the way Error Handling is done.


By default, if an error occurs during script execution, an error message is displayed and the execution is stopped. You can change this default behavior by setting #IgnoreErrors system variable to 1. The lines in the script are then executed sequentially without stopping if an error occurs. Be aware that with #IgnoreErrors=1, it is not possible any more to see why a script execution fails. So when you debug a script, you should temporarily come back to the default setting (#IgnoreErrors=0).




If #IgnoreErrors is set to 0, when an execution error occurs, an error message is displayed and all the scripts are stopped. If it is set to 1, the script goes on and the return code of the function which gave the error can be tested.

The default value for #IgnoreErrors is 0.

If OnAction...Error statement is used, as soon as an error is seen, the procedure defined in the OnAction Error is launched, whatever value has #IgnoreErrors.

See also

Error Handling Overview


#IgnoreErrors=1    ' Ignore errors
#ActionTimeout=5  'Report an error after 5 secs (instead of the default value, 30 seconds)
'Launch notepad

ret=UseWindow("NOTEPAD.EXE|Edit|Untitled - Notepad|1")  ' Use the Notepad window
' Test if the notepad window is there
if ret=0 then
msgbox("Notepad window is present")
msgbox("Notepad window is not present")

UseWindow("BLA.EXE|Edit|Untitled - Notepad|1")  ' Use a window which does not exist - no error message is displayed
#IgnoreErrors=0    ' Come back to default value, after this line, the script stops if an error occurs
UseWindow("BLA.EXE|Edit|Untitled - Notepad|1")  ' Use a window which does not exist - an error message is now displayed