OS X's Services menu
The Apple Services menu is a timesaving feature that has been improved in Snow Leopard. Services were occasionally useful in OS X 10.5, now with 10.6 they are a great feature. Before Snow Leopard, Services weren’t contextual. To run a service called Task, you’d click on Name of active program in the menu bar > Services > Name of program that does task > Task. Because this is so many clicks, and because a lot of services that don’t apply to the current context were listed (grayed out), it was often faster to do a task manually. Snow Leopard fixes this; only the services that you can actually use show up in a list directly under Services. This makes it much easier to find the service you need. In many programs, the applicable services will show up in the right-click menu. I’m now constantly using the Services menu.
Since I am writing (using LaTeX) and doing literature searches, I spend a lot of time with BibDesk, TeXShop, and a web browser. When I need to add a paper to my bibliography I can just select its BibTeX entry from an online database, then right-click (control-click) and select the Add to Bibliography service. Before, I’d save the BibTeX reference as a text file, open it with BibDesk, move the citation to my current bibliography file, and delete the temp file. Or if the database doesn’t include citation files, I’d manually enter it. Now I just use the Add to Bibliography service, saving time and typos.
Apple Automator makes Services more useful by providing an easy way to create your own. When you create an a new Automator Workflow you have the option for it to be a Service. I used this to create a Service to automatically open a new web browser tab with a Google Scholar search. I just select some text, right click, then select Search with Google Scholar, and it opens my search in Safari. This saves time copying and pasting into a new window.
Automator and AppleScript don’t have all the features needed for fancier scripts, but they provide a way to call fancier scripts or other programs. My Google Scholar Service has to escape the search terms so that they can be sent in the search URL. Automator won’t do text processing directly, and there doesn’t seem to be a good way to do this in AppleScript. My solution was to write the escape script in Python. This ran slower than I thought it should, so I rewrote it in Perl, and it was faster. Much faster. I used time
on the command line to test the speed difference. Perl averaged 2 to 5 times as fast. It looks like the difference was in how long it takes to load the necessary libraries. When first running the script, Perl was five times as fast as Python. Later runs decreased the gap to around two times. Without this optimization, this Service wouldn’t have been fast enough, but the optimized version is a time saver.
That’s how I use Apple Services. Here are two example services I made. To install a Service, just place a Workflow in ~/Library/Services/
. [Update 2010-01-07: When installing your first Service you may have to open the Service in Automator and use File > Save As… before OS X recognizes your ~/Library/Services/
folder. From then on you can just move Services to this folder to install them.]
- Search with Google Books Service (5.0 kB)
- Search with Google Scholar Service (5.1 kB)
- Search with Google Maps Service (5.0 kB)
- Search with Wikipedia Service (4.5 kB)
- Open with TextEdit Service (185 kB)
- Open with MacVim Service (117 kB)
Note: These services seem to run much faster if you relaunch Safari and Finder after copying them to ~/Library/Services/
.
Related: My post on Customizing Mac OS X PDF Services
Update 2010-03-06: I added Search with Google Maps, Open with TextEdit, and Open with MacVim services.
Update 2011-10-13: I added the Search with Google Books service.