abort: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
m (Applied MacroFunction template)
m (Corrected capitilization in function name.)
Line 1: Line 1:
{{MacroFunction
{{MacroFunction
|name=Abort
|name=abort
|description=
|description=
Aborts the execution of the current macro and discards all output from the macro if the argument is 0. This function is generally used to abort the processing of a macro if user clicks on the cancel button on a dialog created with the [[Macros:Functions:input | input()]] function. Any properties set before the abort will contain the values you set them to. That is abort(0) will not undo any changes you made
Aborts the execution of the current macro and discards all output from the macro if the argument is 0. This function is generally used to abort the processing of a macro if user clicks on the cancel button on a dialog created with the [[Macros:Functions:input | input()]] function. Any properties set before the abort will contain the values you set them to. That is abort(0) will not undo any changes you made

Revision as of 05:56, 6 March 2009

abort() Function

Aborts the execution of the current macro and discards all output from the macro if the argument is 0. This function is generally used to abort the processing of a macro if user clicks on the cancel button on a dialog created with the input() function. Any properties set before the abort will contain the values you set them to. That is abort(0) will not undo any changes you made

Usage

[h: abort(num)]

Examples

The following example will create a dialog box for the user to enter a value for the variable named blah, if the user clicks on cancel then res will be 0 so the abort() function will cause the macro to terminate, otherwise res will not be 0 so the macro will continue.
[h: res = input("blah")] [h: abort(res)]

This example discards any output in the macro.

Hah! you will never see this! [abort(0)]