Handlers
To define your own commands, you use a handler. A handler is a group of statements that performs some function or task. You might use a handler to define a task that can be used by several parts of the script or to organize your script. To define a handler, you use the On keyword followed by the name of the handler. Any values required by the handler are listed as parameters after the handler's name. Here's an example: In this example, the handler begins with On and is named "setItem." The handler requires one value, which is defined by the parameter "with item_comments." AppleScript executes the handler when it executes the "setItem" statement in the Tell statement. After executing the handler, AppleScript resumes executing statements after the "setItem" statement.
|
Table of contents |