Re: Calling an Applescript from Cocoa Java App
Re: Calling an Applescript from Cocoa Java App
- Subject: Re: Calling an Applescript from Cocoa Java App
- From: Bill Cheeseman <email@hidden>
- Date: Mon, 14 Jan 2002 12:07:17 -0500
on 02-01-14 11:05 AM, Ian Gillespie at email@hidden wrote:
>
I think this should be easy, but I can't get it to work. I hooked up a
>
button in interface builder to an Applescript script. I added the script
>
to Project Builder and put some basic code in it. But when I run the app
>
and try to open the window with the button on it I get the following
>
error:
>
>
>
class error for 'ASKNibObjectInfoManager': class not loaded
>
>
>
I added two Applescript frameworks to the project but it still doesn't
>
work. Anyone got any suggestions of what I need to do. I am a novice
>
programmer so the more detail the better.
This is your second post of this question. I think you haven't gotten any
answers because nobody understands your question.
You suggest that you started by creating an AppleScript script file somehow,
but you don't say how. Since you say you "added" it to Project Builder, it
sounds like you created the script in some other application, external to
Project Builder. Did you use Script Editor? If so, I'm curious to know
whether you saved it as a text file, or a compiled script, or a script
application -- although it wouldn't make any difference, since you can't use
either of the latter two kinds of files in Project Builder. Or did you use
Text Edit and just type in some AppleScript code? Or am I wrong in
understanding that you started by creating a script externally to Project
Builder?
What do you mean when you say you "added the script to Project Builder"?
What did you add? From where? How did you "add" it?
What do you mean when you say you "put some basic code in it"? The order of
your presentation suggests that you did this after "adding" some original
script to Project Builder. How did you do this? Did you just use Project
Builder's internal text editor to type in some AppleScript statements?
And you say you "hooked up a button in interface builder" to this script.
How did you do that?
Have you described the order in which you did these things correctly? It's
hard to tell from your question, but I understand from your description
that, in this order, (1) you created an AppleScript script somehow, (2) you
added it to Project Builder somehow, (3) you put some (more?) (AppleScript?)
code in it somehow, (4) you added two AppleScript frameworks to the project
(you don't say which frameworks), (5) you hooked up the script file to a
button in Interface Builder somehow, (6) you built the application
(successfully, I assume, although I don't see how), and (7) you ran it and
got a runtime error (or maybe you combined steps 6 and 7 and got a compiler
or linker error).
I ask these questions, because just about every step you describe sounds
like nothing you're supposed to be able to do in Project Builder or
Interface Builder. Your description sounds as if you created a script in
some external application (Script Editor? Text Edit?), then used Project
Builder's "Add Files" command to add it to your project (or maybe you just
dragged it into the Project Builder folder in the Finder), then used Project
Builder's internal text editor to type in some more AppleScript code. You
can do all those things, but I don't know how you would get from there to
hooking the script up to a button in Interface Builder. AppleScript files
can't just be typed or loaded and then executed in this fashion AFAIK, if
that's what you're doing.
If you're using AppleScript Studio, you need to work through the manual and
the examples, which should answer this sort of question. The error you're
getting makes it sound as if Project Builder is looking for the
AppleScriptKit.framework ("ASK") but can't find it -- presumably because you
haven't installed AppleScript Studio.
And, in the current Mac OS X, you don't normally have to explicitly add any
AppleScript frameworks to a project. If you're trying to build a scriptable
Cocoa application (which doesn't sound like what you're doing), the
necessary frameworks are included by including Cocoa.framework AFAIK. Unless
you're trying to build a Cocoa application that is scriptable with the new
AppleScript Studio dictionaries, which does require including
AppleScriptKit.framework AFAIK. If you're just trying to use AppleScript
Studio to build an AppleScript application, just installing AppleScript
Studio from the Developer Tools CD and opening one of the three provided
AppleScript Studio templates is all you need to do -- they include
AppleScriptKit.framework along with Cocoa.framework already.
Sorry if I've misunderstood your question. But it leaves me with the
impression that you need to do some very basic reading in the Cocoa
documentation before you go any farther. I tend to get somewhat testy when I
can't understand a question, which explains the tone of this reply.
--
Bill Cheeseman - email@hidden
Quechee Software, Quechee, Vermont, USA
http://www.quecheesoftware.com
The AppleScript Sourcebook -
http://www.AppleScriptSourcebook.com
Vermont Recipes -
http://www.stepwise.com/Articles/VermontRecipes
Croquet Club of Vermont -
http://members.valley.net/croquetvermont