Domanda

I cannot find instruction on how to execute my Applescript from a menu (or a hotkey) in Numbers, or any other iWork application. I have no doubt that someone asked about this before, just cannot find it... Google has a few instructions on this topic, but these are very dated as far as I can tell.

The script is already in ~/Library/Scripts.

Can it be done? And if so, how?

È stato utile?

Soluzione

If you'd rather not have to install a third-party application like FastScripts, (although FastScripts is pretty great), you could do it this way.

Turn on the Script Menu in your Menu Bar. (It looks like a scroll.)
1. Open the AppleScript Editor which is in ~/Library/Applications/Utilities not the library folder off your user account, but the root library folder on your hard drive.
2. Choose "Preferences" from the main menu, make sure "General" is selected, and check the box that says, "Show Script menu in menu bar".

Create your script in the AppleScript Editor and save it to:
~/Library/Users/[Your User Account Name]/Library/Scripts/Applications/[Your Application Name]
So, if my user account is named Foo and I'm saving a script I want to use in Coda I would save it to:
~/Library/Users/Foo/Library/Scripts/Applications/Coda

Now when I'm in Coda, and I click on the "Script Menu" icon that now appears in my menu bar, I get a drop-down list of scripts that I can execute, including a section specific to the app, which should now include your script.

These instructions are good for OSX Lion and Mountain Lion. Before that, installing the Script Menu was handled by executing one of the example scripts that came with the operating system.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top