• 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: Variables inside handlers
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Variables inside handlers


  • Subject: Re: Variables inside handlers
  • From: Paul Berkowitz <email@hidden>
  • Date: Tue, 10 Dec 2002 21:04:57 -0800

On 12/10/02 8:48 PM, "The Other Rob" <email@hidden> wrote:

> Thanks to the help of some generous people on this list, I've worked out the
> following bits of scripting.
>
> This script launches my script application called test3app:
>
> ignoring application responses
> launch application "OSX:test3app"
> run application "OSX:test3app"
> tell application "OSX:test3app" to somehandler("$1", "$2", "$3")
> end ignoring
>
>
> And this is the relevant code from test3app:
>
> on somehandler(test1, test2, test3)
> -- various lines that do stuff with test1, test2, test3
> end somehandler
>
>
> My problem is that the scope of the variables (test1, test2, test3) is
> limited to that particular handler, and I can't access them from other parts
> of my test3app script. Is there any way to make these variables available
> to the rest of my script?

Instead of making them parameters of somehandler, make them properties (or
global variables) of "OSX:test3app" . It would look like this:

property test1 : missing value
property test2 : missing value
property test3 : missing value

--main script, other handlers

on setProps(a, b, c)
set test1 to a
set test2 to b
set test3 to c
end setProps

on somehandler()
-- various lines that do stuff with test1, test2, test3
end somehandler


Then your other script would eventually:

tell application "OSX:test3app"
setProps("$1", "$2", "$3")
somehandler()
-- other stuff
end tell

But I don't quite understand why you're first running it, then calling other
handlers.


--
Paul Berkowitz
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

References: 
 >Variables inside handlers (From: The Other Rob <email@hidden>)

  • Prev by Date: Variables inside handlers
  • Next by Date: Re: Variables inside handlers
  • Previous by thread: Variables inside handlers
  • Next by thread: Re: Variables inside handlers
  • Index(es):
    • Date
    • Thread