Re: Calling a nib item from AppleScript (and more..)
Re: Calling a nib item from AppleScript (and more..)
- Subject: Re: Calling a nib item from AppleScript (and more..)
- From: Philip Aker <email@hidden>
- Date: Mon, 02 Jun 2008 16:36:53 -0700
On 08-06-02, at 15:18, J. Todd Slack wrote:
Hi All,
I have an application where I create an NSStatusItem on application
startup.
I want to call Applescript when a menu option is choosen.
In Interface builder, I have a menu whos has a script defined.
When I add a menu option it gets an index of 1 and a scope Global. I
then click on the Applescript tab and give it the name "RMCreate"
and select my Applescript and I select that it should respond to
'choose menu item.
Then in AppleScript I have:
on choose menu item theObject
if the name of theObject is equal to "RMCreate" then
display dialog ("test")
end if
end choose menu item
So I am expecting that when I select that menu option that I get a
dialog that pops up so I can verify i hit inside that conditional.
But instead I get an error:
AppleScript Error: Can't get <class menl> id 3 of item if 1 (-1728)
Can anyone tell me what this means and what I am doing wrong?
I thought I have done this before.
Leopard 10.5.3, XCode 3.0
I could be wrong, but I don't think NSStatusItems are directly
eligible as AppleScript Studio objects even though NSMenu and
NSMenuItem are.
One way to check would be to try to log theObject and see what happens.
errAENoSuchObject = -1728, /* e.g.,: specifier asked for the 3rd, but
there are only 2. Basically, this indicates a run-time resolution
error. */
Philip Aker
echo email@hidden@nl | tr a-z@. p-za-o.@
Democracy: Two wolves and a sheep voting on lunch.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden