• 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: Calling a script object
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Calling a script object


  • Subject: Re: Calling a script object
  • From: Paul Berkowitz <email@hidden>
  • Date: Tue, 09 Sep 2003 21:06:30 -0700

On 9/9/03 8:42 PM, "Richard Fairbanks" <email@hidden> wrote:

> As an AppleScript novice, I've been baffled by this for several hours and it's
> time to ask the pros.
>
> I have a stay-open script app (let's call it "testApp") that runs fine when
> launched, but chokes on the handler when called from another script. As an
> example, the following runs as expected when launched:
>
> script test1
> global x
> set x to "it worked"
> say x
> test2() -- FYI, "my test2()" doesn't work either
> on test2()
> say x
> set x to "twice"
> say x
> end test2
> end script
> tell test1 to run
>
> But when I call it from another script:
>
> tell test1 of application "testApp" to run
>
> The first statements run fine but then I get the error: "B+scriptB; doesn't
> understand the test2 message".


If you're calling it as an application, you run into problems since
applications don't know about things like handlers.

Instead, load the app as a script.

set f to load script alias "path:to:testApp" --real path
tell f to run

--
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.

  • Follow-Ups:
    • Re: Calling a script object
      • From: Thomas Taylor <email@hidden>
    • Re: Calling a script object
      • From: Richard Fairbanks <email@hidden>
  • Prev by Date: Re: checking for characters
  • Next by Date: delay procedure for waiting less than a second
  • Previous by thread: Re: Dates gone wild
  • Next by thread: Re: Calling a script object
  • Index(es):
    • Date
    • Thread