Re: Run script with parameters?
Re: Run script with parameters?
- Subject: Re: Run script with parameters?
- From: Ted Wood <email@hidden>
- Date: Tue, 24 Apr 2001 22:29:53 -0700
For those new to AppleScripting, here's some information about the
'invisible' Run handler...
The 'Run' handler is always there in a script. It encloses all root
level commands typed into a script or script object. For example, if
my entire script were to consist of the following commands...
beep
display dialog "Hi there!"
AppleScript would see this...
on run()
beep
display dialog "Hi there!"
end run
Similarly, in script objects, such as this...
script myScript
beep
display dialog "Hi there!"
end script
'beep' and 'display dialog' are at the root level of that script
object, so AppleScript would see this when the script object was
invoked...
script myScript
on run()
beep
display dialog "Hi there!"
end run
end script
Now, you can control this behavior if you need to call the Run
handler from within a script or pass it parameters by enclosing *all*
root level commands within a 'visible' Run handler, as you'd declare
any other handler.
Hope that helps to clarify a few things.
Ted