PDA

View Full Version : Xcode - Applescript




S0ULphIRE
Jun 6, 2009, 02:39 AM
I'm trying to put together a simple app, basically to automate a login process.
For now though I'm stuck with the status menu.

Here's what I've done so far:
I've created the status menu (the one in the top right of the screen), hidden the rest of the app, and created two items in the menu called 'Clock IN' and 'Clock OUT'. I created the menu with Interface Builder.

I then created a VERY simple applescript:
on choose menu item theObject
display dialog "You chose one of the menu items"
end choose menu item

The Problem: When I select either of the two menu items, I get an error:
"Can't get menu item id 1 (edit: or 3) of item id 2. (-1728)"

Everything else is working as it should, the icon for the menu, the menu item names, etc. Is there something else I have to do in Interface Builder that I'm missing? Right now I've created the menu, created an NSObject, and linked the menu to the object. I've also defined the applescript names for the menu, menu items and object, and I've selected the 'Choose Menu Item' option for both the ClockIN and ClockOUT menu items.

I have absolutely no idea what's gone wrong, any suggestions would be appreciated.
Cheers!