Re: Newbie Progress Bar
Re: Newbie Progress Bar
- Subject: Re: Newbie Progress Bar
- From: Cal <email@hidden>
- Date: Mon, 18 Dec 2000 00:10:03 -0500
JollyRoger <email@hidden> wrote:
on 12/16/2000 3:11 PM, Shane Stanley at email@hidden wrote:
On 17/12/00 4:21 AM +1000, JollyRoger, email@hidden, wrote:
>> Note: In Applescript, we call them "handlers" not "subroutines".
I'm not sure who "we" are, but my copy of the ASLG uses both names --
subroutines are handlers for user-defined commands.
I recall having a long discussion about it with Cal, where he told me I
should call them handlers rather than routines or functions. I'm just
passing on what he taught me.
There's my cue:
A handler in AppleScript is basically equivalent to a routine in
programming languages. In AppleScript, there are two kinds of
handlers, subroutine handlers and command handlers.
Subroutine handlers are equivalent to subroutines in programming
languages (both procedures and functions in Pascal; functions in C);
the parameters in the declaration are made up by the scripter, and
are either of the positional variety (a, b, c), or of the keyword
variety (from the list of 21 allowable keywords).
to MakeANewPage(....)
-- commands that create a new page
end MakeANewPage
to square(x)
return x * x
end square
Command handlers respond to a particular command (event); the
parameters in the declaration are usually defined in a terminology.
to run
end run
to open itemList
end open
on idle
end idle
on quit
end quit
Subroutine handlers are usually called within the same script.
Command handlers usually respond to an inter-application message
(Apple event). That said, AppleScript allows either kind of handler
to be called either way (a call within a script, or respond to an
interapplication message).
Cal