Skip to main content
Skip table of contents

OnExit: run another script or display a MsgBox upon main script termination

Tag: OnExit

A script from another file/job or from a variable in the current script can be executed, or a message displayed, after the main script ends.

Tag Attributes


Attribute Values

Value Description


User Definable

The external script file path and name to be used.


User Definable

The variable to be used.

NB: here the variable name must be used without the variable syntax {% and %}

<OnExit ExecuteVar=”VarName”/> is OK

<OnExit ExecuteVar=”{%VarName%}”/> is NOT OK


User Definable

The message to display after the script ends.

MsgBox, Execute and ExecuteVar are not mutually exclusive.

When a combination is set, the sequence is:

  1. MsgBox

  2. Execute

  3. ExecuteVar

When set in an OnExit action, Execute and ExecuteVar indicate which automation directives to run after the script ends. The exit actually triggers a regular Execute / ExecuteVar call.

Example Script


	<SetVar MyVar="USE_CDATA" BypassVar="true">
		<![CDATA[	<SetVar Exit1="var 1"/>
					<MsgBox Message="ON EXIT EXECUTEVAR: {%Exit1%} {%Exit2%}!"/>]]>

	<OnExit executeVar="MyVar" execute="onExit-X.xml" MsgBox="ON EXIT MSGBOX"/>

	<SetVar Exit2="var 2"/>
	<MsgBox Message="SCRIPT IS ENDING"/>

The sequence is:

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.