Tags : :
Originally Posted by EricN on March 28, 2010 at 10:30am
The Apple's Services Menu has been completely overhauled in Snow Leopard. It is now easy to both use and set up your own services. Moreover, Apple has also made it simple to attach keyboard shortcuts to Service Menu Items. This is so useful that I've decided to make a quick tutorial: everyone should know how this works.
In case you are not familiar with it, the Services Menu provides quick access to system wide services when using any application. It is found in the main application menu of any application.
As an example, I'll run through how to set up a service that rotates your display. First, download fb-rotate from this post. Then put it in a convenient folder (I've put it in ~/Library/Application Support/RotateDisplay/). Now, Launch Automator (found in your Applications folder). You will be confronted with a choice of templates. Choose the Service template.
At The top of the Automator window, there will be two drop down menus:
For our purposes, we'll choose, as shown: Service receives "no input" in "any application". (When setting up other sorts of services, the other options maybe useful.)
Now select, from the first column, "Utilities" and, from the second column, grab "Run Shell Script" and drag it into the workflow pane.
Our first service will rotate your display to the 180º orientation. Begin by deleting the word "cat" from the script window. Then find fb-rotate in Finder and drag the file into the script window.
This will insert the path to fb-rotate in The script window. It should look something like:
Now put single quotes around the path and add the following text at the end: -d 0-r 180
If you are using a Macbook, you are good. If you are using a Modbook, you need to add another line:
/usr/bin/osascript -e 'tell application "TabletDriver" to set orientation of tablet 1 to landscape flipped'
Automator's script window should look something like:
Clicking on the Run button will test the script. If it works, save it using the name that you want to appear in the Services Menu.
The scripts for rotating the display into the other orientations would be analogous:
Rotate Display 0º:
'/Users/<your user name>/Library/Application Support/RotateDisplay/fb-rotate' -d 0 -r 0
/usr/bin/osascript -e 'tell application "TabletDriver.app" to set orientation of tablet 1 to landscape'
Rotate Display 90º:
'/Users/<your user name>/Library/Application Support/RotateDisplay/fb-rotate' -d 0 -r 90
/usr/bin/osascript -e 'tell application "TabletDriver.app" to set orientation of tablet 1 to portrait'
Rotate Display 270º:
'/Users/<your user name>/Library/Application Support/RotateDisplay/fb-rotate' -d 0 -r 270
/usr/bin/osascript -e 'tell application "TabletDriver.app" to set orientation of tablet 1 to portrait flipped'
[Warning: if you are using a Macbook or Modbook with the Intel GMA graphics do not use the scripts for 90º or 270º. You may not be able to rotate back out.]
A Modbook owner is likely to use this service a lot, so might be nice to have a keyboard shortcut that will run the service. To this end, launch System Preferences, select the keyboard pane and find your newly minted service in the Keyboard Shortcuts tab.
Clicking to the right of the services name opens a small text box into which you can enter your shortcut. Be sure that you’re not assigning a shortcut that is already in use.
Now that you've created these display rotation services, you are ready to add more. Use the "Run AppleScript" Automator action to make a service of any AppleScript, such as any of these (or these or these). Follow the directions at Geek and Mild to make a cool title case service or get acquainted with Automator and make a service of any Automator action. Have Fun.