Exit Method




Terminates the application by closing all open windows, including the main window.


mainwin.Exit ( )


Exit terminates the application containing the main window. It first closes all open application windows and then closes the application itself.

Exit starts with the current active window and attempts to close it using the following sequence, stopping when the window closes:

  1. If a Close method is defined for a window, call it. If that does not close the window, none of the following steps will be executed.
  2. Call window.CloseBox.Click() (on Windows).
  3. Call window.SysMenu.Close.Pick() (on platforms and windows that have system menus).
  4. If the window is a dialog, type the keys specified in OPT_CLOSE_DIALOG_KEYS and wait one second for the dialog to close.
  5. If there is a single button on the window, click the button.
  6. Click the list of buttons specified in OPT_CLOSE_WINDOW_BUTTONS.
  7. Select the menus specified in OPT_CLOSE_WINDOW_MENUS.

Once one window closes, Exit follows the sequence with the next active window, until all windows are closed.

When closing any window causes the application to display a confirmation dialog, Exit attempts to close the dialog using the list of buttons specified in the OPT_CLOSE_CONFIRM_BUTTONS option.

If the windows cannot be closed (for example, because the application displays a message box that cannot be closed with the buttons specified in OPT_CLOSE_CONFIRM_BUTTONS), Exit unconditionally terminates the application and issues a warning.

If the application does not terminate normally, Exit prints the following message to the Results file:

*** Warning: Application not terminated cleanly

This method supports several options for specifying how a window should be closed:

To specify Set this option Or set this variable
To use non-standard buttons to close a confirmation dialog OPT_CLOSE_CONFIRM_BUTTONS lsCloseConfirmButtons
To use non-standard buttons to close a window OPT_CLOSE_WINDOW_BUTTONS lsCloseWindowButtons
To use non-standard menu items to close a window OPT_CLOSE_WINDOW_MENUS lsCloseWindowMenus
To use non-standard keyboard input to close a dialog OPT_CLOSE_DIALOG_KEYS lsCloseDialogKeys

You can make these specifications using either the SetOption method, by defining the specified variable, or by using the settings in the Close panel on the Agent Options dialog.


	[-] if (TextEditor.Exists ()) 
		[ ] TextEditor.SetActive () 
	[ ] TextEditor.Exit ()