Re: Handler query - exchanging values
Re: Handler query - exchanging values
- Subject: Re: Handler query - exchanging values
- From: Yvan KOENIG <email@hidden>
- Date: Thu, 29 Jun 2006 15:31:28 +0200
Le 27 juin 2006, à 05:11, Malcolm Fitzgerald a écrit :
-------------------------------------
global apples, bananas, grapes, oranges
firstHandler()
on firstHandler()
global apples, bananas, grapes, oranges --> declares that these
variables are global - not local
set {apples,bananas} to {1,2} --> as a general rule lists are
faster
my secondHandler() --> no need to pass params, they're global!
log {a:apples,b:bananas,g:grapes,o:oranges}
end firstHandler
on secondHandler() --> no params because we're using globals
global apples, bananas, grapes, oranges --> declares that these
variables are global - not local
if apples is 1 then set oranges to 3
if bananas is 2 then set grapes to 4
--> no need to return data as the variables are global and will be
seen outside this handler
end secondHandler
------------------------------------------------
Hello Malcolm,
Just matter of curiousity. For my own needs, I prefer to pass the
needed values from one handler to an other one.
what need for the " set variables as global" in the handlers ?
I thaught that defining them as global in the main script was
sufficient.
For see, I removed the two " set variables as global" instructions from
the handlers and didn't sew any odd effect.
Am'I missing something ?
Yvan KOENIG
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden