Re: Calling a script object
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.