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 17:19:03 -0500
OK, that I understood. You are using AppleScript Studio, and using it
correctly. The way you set up the button and the Clicked handler are
correct. I just did the same thing in an application I'm working on, and it
worked as expected.
So, since the error occurs when you open the window, I would look at the
window opening code to see if you have an error there. Perhaps you should
comment out the Clicked handler and uncheck the Clicked event handler in the
Info panel, then try building your app and opening the window again. If the
error still occurs, you'll know it's the window opening code.
The error suggests you haven't loaded the nib file. Usually in a pure
AppleScript Studio app, when you open a window you want your Will Open
handler to call 'load nib "<nib file name without ".nib">"', then call 'set
visible of theObject to true'.
on 02-01-14 4:46 PM, Ian Gillespie at email@hidden wrote:
>
Sorry if my question was not clear. Here is a more step by step
>
description of what I did.
>
>
I have an app that works fine--it builds and runs. I opened up one of
>
it's nib files in IB and added a button (NSButton) to a window
>
controlled by that nib file. On the IB Inspector, I selected
>
AppleScript from the popup menu and then selected the newly added
>
NSButton on the window. I then checked the "action" checkbox and
>
"clicked" checkbox under event handlers on the IB Inspector. I then
>
clicked "New Script" from the IB Inspector and it asked if I wanted to
>
add the script to my project in PB, I gave it a name (let's call it
>
aScript) and saved it and the aScript.applescript appeared in project
>
builder along with my .java files.
>
>
Up to this point, I was under the impression that when my button would
>
be clicked, it would call the script that was just added to project
>
builder from interface builder. In PB I edited the script to this:
>
>
on clicked theObject
>
tell application "Mail"
>
>
end tell
>
end clicked
>
>
The app compiles fine and launches, but when I try to open the window
>
which has the button on it, I get the error I mentioned above and the
>
app crashes. Any suggestions?
--
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