8.3 Overview of Methods

A method is a command that directs an object to perform an action. For example, the JumpNext method of the Sessions object transfers focus from the currently active session to the next session. The Copy method of the Screen object copies the selected screen area to the Clipboard.

Method Syntax

To refer to a method, use the following dot syntax: object.method

Some methods take arguments:

object.method arg1,arg2,...

Some methods return values as well:

rc = object.method (arg1,arg2,...)

Note the syntax difference in the last two statements: when the return value is saved to a variable, the arguments are enclosed in parentheses. Even if there is no argument list, include parentheses:

rc = object.method ( )

Default Methods

Every object has a default method, that is, a method that does not have to be explicitly stated in an expression. For example, the Item method is the default method for collection objects. Each of the following two statements closes the third session in the Sessions collection: