Re: Call a handler from applescript
Re: Call a handler from applescript
- Subject: Re: Call a handler from applescript
- From: Paul Berkowitz <email@hidden>
- Date: Fri, 30 Jan 2004 13:21:51 -0800
On 1/30/04 12:14 PM, "Yan Wong" <email@hidden> wrote:
>
> Paul Berkowitz <email@hidden> wrote
>
>
>
> On 1/30/04 5:27 AM, "Walter Ian Kaye" <email@hidden>
>
> wrote:
>
>> Hmm. It works for "regular" applets made by Script Editor.
>
>> Maybe AS Studio apps require a different technique?
>
>
>
> This isn't a Studio application, I don't think. It's an applet. The
>
> problem
>
> derives from the fact that all applets have the same creator code
>
> "aplt",
>
> rather than a unique creator code such as commercial application
>
> have. Your
>
> system does not know 'application "Signal"' and probably picked some
>
> other
>
> applet on Yan's computer, which does not have a my_signal handler.
>
>
No, it is an Applescript Studio application (well, written in XCode
>
actually)
>
>
> If this is just for your own use, just hardcode the full path to the
>
> applet
>
> in:
>
>
This is what I did exactly:
>
>
1) created a new applescript studio application in XCode called "test2".
>
2) placed the following code in test2.applescript:
>
>
on my_signal(txt)
>
display dialog txt
>
return 0
>
end my_signal
>
>
3) changed the signature of the target executable to "SHSC" (it could
>
have been anything)
>
>
4) compiled it and moved the test2.app application in the build folder
>
to /Applications
>
>
5) Opened script editor, and pasted the following code in
>
>
tell application "MyDisk:Applications:test2.app:" to activate
>
tell application "MyDisk:Applications:test2.app:" to my_signal("hello")
>
>
----
>
When run, this applescript opens the "test2" application, then produces
>
the error:
>
test2 got an error: Can't continue my_signal.
>
>
So what am I doing wrong?
Ah, a Studio application. You might be better to ask on the separate mailing
list for applescriptstudio.
I believe that you can't speak to a Studio Application as to an applet. The
handlers in its .applescript files (even when they become .scpt files)
aren't handlers of the application itself as they would be of an applet.
There may be a way to find the path to the actual .scpt file inside the
app's bundle. That may or may not work. In any case it wouldn't be the
actual app doing things, but just its script. (I'd bet this doesn't work.)
I think you can probably make the app scriptable, as any Cocoa app. You'd
need to ask on the Studio or Cocoa lists. Someone there will know.
--
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.