views:

50

answers:

1

Hi. I have added a menu item to menu controller window by dragging a item from library. Now i want to provide a action to that menu such as on click that menu item a applescript file should run. Can any body help me out this?

+3  A: 

Declare an action method in your controller's header, then save the header file. Then, in IB, ctrl-drag from the menu item to the controller, and choose the action you just declared.

Then, in the controller's implementation file, implement the action method. You'll need to create either an OSAScript (using OSAKit.framework—no docs; you'll need to read its headers) or an NSAppleScript (using AppKit) instance and tell it to execute.

Peter Hosey