Re: Calling a script object
Re: Calling a script object
- Subject: Re: Calling a script object
- From: Thomas Taylor <email@hidden>
- Date: Thu, 11 Sep 2003 12:33:47 -0500
When I tried Paul's solution, I just get a new script file window that
is empty. Don't know what I'm missing? However, I did find out that you
can also use 'on run', ie:
prg1
set f to load script alias "Macintosh
HD:Users:tommyt:development:applescripts:onrun2" --real path
tell f to run
prg2
on run
display dialog "hello"
end run
I don't know what the advantages or disadvantages are, but I though I
would throw it out there.
On Tuesday, September 9, 2003, at 11:06 PM, Paul Berkowitz wrote:
>
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.
>
>
Thanks,
Thomas Taylor
17106 76th Ave
Maple Grove, MN 55311
email@hidden
_______________________________________________
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.