Re: How do you get two scripts to communicate?
Re: How do you get two scripts to communicate?
- Subject: Re: How do you get two scripts to communicate?
- From: Graff <email@hidden>
- Date: Thu, 01 Jan 2004 18:17:34 -0500
Try this for the second script:
------------
tell application "Sayhi"
set greet to sayhi("jim")
end tell
display dialog greet
------------
This worked fine for me. I think the problem is the "my greet"
construct. I don't believe you can use the keyword "my" in reference
to a variable, only in reference to a handler or a property. For
example:
Script named "sayhi" and saved as an application:
----------
on sayhi(aname)
set tt to "Hi, " & aname
return tt
end sayhi
----------
A separate Script named "comm.scpt"
----------
on sayhi(aname)
set tt to "Hello, " & aname
return tt
end sayhi
tell application "Sayhi"
display dialog sayhi("Jim")
display dialog my sayhi("Jim")
end tell
----------
You will get a dialog box that says "Hi, Jim" and when you dismiss it
you will get another that says "Hello, Jim" The first call to sayhi
uses the one from the application that you are telling, the second call
to sayhi is to the one in the script which is running.
- Ken
On Jan 1, 2004, at 4:58 PM, James Burton wrote:
I read somewhere that one applescript can call another's handler,
However, I have tried the following:
Script named "sayhi" and saved as an application:
----------
on sayhi(aname)
set tt to "hi, " & aname
return tt
end sayhi
----------
a separate Script named "comm.scpt"
----------
tell application "sayhi"
set my greet to sayhi("jim")
end tell
return greet
----------
The idea is to run comm.scpt, which in turn runs the "sayhi" handler in
sayhi, and returns the greeting. However, this script ends with an
error "sayhi got an error: Connection is invalid."
Someone please enlighten me on the proper way to get two applescrpt
apps to communicate :-)
_______________________________________________
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.
_______________________________________________
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.