On Aug 16, 2012, at 13:23:21, David Porter wrote:
> Can I add a menu item using a startup script? I know scripts can call menu items, and I know I can add something to the contexual menu items, but can I, say, add an item to the "File..." Menu?
Yes. There are a few ways you can do it.
1. You can add scripts to the Startup Items folder which will add the menu items to the menus. Then you also need to add scripts to the Scripts Folder that have the same names as the menu items you added. These are the scripts that actually do the work you want to do.
2. Or you can utilize the newish Menu Scripts folder I added at some point (I don't remember which version). This is much easier, because you don't have to maintain 2 scripts for each menu item. Here's a shell for you to build on:
using terms from application "MultiAd Creator Pro"
on add menu script items
return {{add after menu item:"Print…", of menu named:"File", handler name:"ThisIsTheNameOfTheHandlerYouWantToUse", name:"Test", key equivalent:{key:"\\", modifiers:{command}}}}
end add menu script items
end using terms from
on ThisIsTheNameOfTheHandlerYouWantToUse(menuPath)
tell application "MultiAd Creator Pro"
say "hi there"
end tell
end ThisIsTheNameOfTheHandlerYouWantToUse
Just fill out the needed part of this and save it to the Menu Scripts folder in Add-Ons.
--
Steve Mills
Drummer, Mac geek