#IgnoreErrors

System variable - Windows management, File management, Program flow management, System, Com management.

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

Usage

Used to change the default way execution errors are reported. By setting #IgnoreErrors=1, the lines in the script are executed sequentially without stopping if an error occurs. Be aware that with #IgnoreErrors=1, it's 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 settings (#IgnoreErrors=0).

Syntax

#IgnoreErrors = 0
or
#IgnoreErrors = 1

Remarks

If this variable is set to 0, when an execution error occurs, an error message is displayed and all the scripts are stopped.

If this variable is set to 1, the script goes on and the return code of the function which gave the error can be tested.

For the file management functions, the possible return codes are:

0 No error
2 or 9 File not found
3 Path not found
4 Too many files opened
8 Not enough memory
15 Incorrect disk
16 Error on the current disk
19 Error write protection
26 Specific to Vista, Error in file creation

 

The default value for #IgnoreErrors is 0.

 

All the statements which simulate an action by WinTask return a return code (except ClickMouse and MoveMouse). This return code can be tested ; it's always 0 if the action has been successfully completed. If #IgnoreErrors=1, all the errors generated by these statements are ignored. The programmer can then test the return code of each individual statement. If the return code is not 0, the programmer must manage the error situation.

If OnAction Error construction is used (not available in WinTask lite), as soon as an error is seen, it's the procedure defined in the OnAction Error which is launched, whatever value has #IgnoreErrors.

See also

Error Management

#ErrorCode, #ErrorFunction$, #ErrorMsg$, #ErrorScript$, #LastErrorLine, #LastErrorLine$