• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Handler query - exchanging values
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Handler query - exchanging values
      • From: Malcolm Fitzgerald <email@hidden>
References: 
 >Handler query - exchanging values (From: email@hidden)
 >Re: Handler query - exchanging values (From: Malcolm Fitzgerald <email@hidden>)

  • Prev by Date: send commands to interactive prompt
  • Next by Date: Re: send commands to interactive prompt
  • Previous by thread: Re: Handler query - exchanging values
  • Next by thread: Re: Handler query - exchanging values
  • Index(es):
    • Date
    • Thread