Re: Handler query - exchanging values
Re: Handler query - exchanging values
- Subject: Re: Handler query - exchanging values
- From: Axel Luttgens <email@hidden>
- Date: Fri, 30 Jun 2006 09:26:30 +0200
On 30/06/06 6:53, Malcolm Fitzgerald wrote:
On 29/06/2006, at 11:31 PM, Yvan KOENIG wrote:
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 ?
try this
-----------------------------
global apples, pears
set apples to 3
boo()
hoo() --> error: the variable apples is not defined
on boo()
set apples to 1
end boo
on hoo()
display dialog apples
end hoo
-----------------
Something changed recently (time to carefuly read the release notes?).
This has always worked, and is of course the way one would expect
globals to be accessed:
-- OK up to 10.4.7
boo()
hoo()
on boo()
global apples
set apples to 1
end boo
on hoo()
global apples
display dialog apples
end hoo
But previously, one had terrible lexical scoping clashes that required
to be extremely careful:
-- OK up to 10.3.9
-- (fortunately) fails since 10.4.x
global apples
boo()
hoo()
on boo()
set apples to 1
end boo
on hoo()
display dialog apples
end hoo
Thanks for having shown that point,
Axel
_______________________________________________
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