Language Guide

CHAPTER 9
Script Objects
280 Inheritance and Delegation
script Andrea
property parent : Hugh
on identify()
continue identify()
end identify
end script
tell Hugh to identify()
--result: <<script Hugh>>
tell Andrea to identify()
--result: <<script Andrea>>
Using Continue Statements to Pass Commands to Applications 9
Scripting addition commands and application commands sent to script
objects don’t trigger their associated actions until they’re received by the
default target application. This means you can use a handler for such
commands within a script object to modify the way the command works
when sent to that script object.
For example, the handler for the Beep command in the example that follows
modifies the command by displaying a dialog box and allowing the user to
decide whether to continue or not:
script Joe
on beep
set x to display dialog ¬
"Do you really want to hear this awful noise?" ¬
buttons {"Yes", "No"}
if the button returned of x is "Yes" then ¬
continue beep
end beep
end script
tell Joe to beep