![]() The menu items in the Script Menu represent the folders and script files inside /Library/Scripts and ~/Library/Scripts AppleScript Utility provides an option for toggling the visibility of the /Library/Scripts items. If you don't see it, you can turn it on with the AppleScript Utility. It appears as a status menu item (on the right side of the menu bar) in the form of a black scrolled s-shaped icon. There is also a Script Menu provided by Apple that gives systemwide access to scripts this is particularly helpful when a script needs to be available from every application, or when its target application has no Script menu of its own. Mail's File Import Mailboxes menu item works this way. This makes sense when an application is scriptable and can best implement a command's functionality by taking advantage of its own scriptability. For example, an application might incorporate scripts as ordinary menu items. Apple's Script Editor takes a different approach: instead of a Script menu in the menu bar, it lets you access the compiled script files in a specific location by way of the contextual menu (see "Apple's Script Editor," earlier in this chapter).Īn application can act as a script runner in a noncustomizable way as well. Some other programs that act as script runners through a Script menu are Script Debugger, Smile, Microsoft Entourage, Tex-Edit Plus, and various Adobe applications. As an alternative interface, BBEdit also lists and lets you access scripts in a floating window. BBEdit also provides some useful naming conventions for setting the order of the items in the Script menu (otherwise the scripts would always appear in alphabetical order, because that's how the Finder supplies them) read the BBEdit manual to learn more. BBEdit also implements some further conventions that have become a sort of de facto standard: you can edit a script by holding Option as you choose it from the Script menu, and you can reveal a script file in the Finder by holding Shift as you choose it from the Script menu. ![]() For even more convenient access, BBEdit lets you assign keyboard shortcuts to these menu items. Whatever compiled scripts you place in ~/Library/Application Support/BBEdit/Scripts/ will appear as menu items in BBEdit's Script menu, where a script can be run by choosing its menu item. ![]() (And when a script in an application's Script menu does target that application, there is sometimes a tremendous speed advantage over running that same script from elsewhere see Chapter 22.)įor instance, as mentioned under "Customization" in Chapter 1, if you put scripts into ~/Library/iTunes/Scripts/, iTunes will generate a Script menu listing them and permitting you to run them so that's a good place to store and access your scripts that customize iTunes.īBEdit is a particularly fine example of a script runner. Scripts in an application's Script menu do not have to target that application, but the feature makes sense, and is provided, in the expectation that they will do so. ![]() This behavior is helpful because, having developed a script that drives such an application in a useful way, you might like some convenient interface for executing that script on future occasions the application's Script menu provides such an interface. Many scriptable applications act as script runners, typically by means of a special Script menu. Because the script is compiled beforehand, a time-consuming step (compilation) is skipped, and execution typically proceeds considerably faster in a script runner than it does in an internally scriptable application where the code must be compiled from text on the fly. There is usually a requirement that a compiled script file be placed beforehand in some particular location where the script runner can find it. Such an application might be called a script runner. An application without facilities for editing or compiling scripts may nevertheless offer to execute compiled scripts for you on demand by way of some convenient interface, such as a menu.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |