Tags : :
Posted by EricN on September 29, 2009 at 10:30pm
If the screencast in my last blog posting on my Modbook’s pen gesture setup gave you a chance to kick the tires and take a brief test drive, this posting provides you with a look under the hood. While everyone uses computers differently, a detailed look at someone else’s approach is often a good jumping off point for your own. In any event, this post will demonstrate the versatility and power of Quicksilver’s Abracadabra pen gesture system that we got a look at last time.
I’ll try to be simple and to the point showing the pen gesture, the associated Quicksilver action, and any special information you need to get it to work. I’m dividing the gestures into three groups: straight Quicksilver actions that work right out of the box, really, really simple AppleScript actions that instruct your computer to punch a key on your keyboard, and more complicated AppleScripts which I will run through in subsequent blog articles. If anything here seems confusing take another look at the screencast or leave some comments — I’ll be happy to respond. From the gestures and actions below, I hope you will be able to find and implement those that make the most sense for you.
Built-in Quicksilver Actions
Recall from the screencast that each gesture is associated with a Quicksilver action which itself is a “functional sentence”. In the table below, the QS object and the QS action are the two parts of that sentence and fill the first two parts of the Quicksilver command window. In the Plug-in/Comments column, I’ve noted some resources within Quicksilver that need to be made available in the form of a plug-in to be installed or a box to be checked in Quicksilver’s Catalog Pane.
QS Object: Activity Monitor.app ... QS Action: open application
QS Object: Calculator.app ... QS Action: open application
QS Object: Dashboard.app ... QS Action: open application
QS Object: iTunes.app ... QS Action: open application
QS Object: Current Application ... QS Action: quit
Check: Proxy Objects in QS–>Catalog
QS Object: QS Command Window ... QS Action: run (invoke QS)
Check: Internal Objects in QS–>Catalog
QS Object: Eject.sh ... QS Action: run
Extra Scripts plug-in
QS Object: Sleep ... QS Action: run
Extra Scripts plug-in
QS Object: Exposé All Windows ... QS Action: run
System Hot Key Commands plug-in
QS Object: Exposé Desktop ... QS Action: run
System Hot Key Commands plug-in
QS Object: http://modbookish.lafora.com ... QS Action: open URL
QS Object: Browse Albums ... QS Action: Show Contents
QS Object: Next Song.scpt ... QS Action: run
QS Object: Previous Song.scpt ... QS Action: run
QS Object: Play-Pause.scpt ... QS Action: run
Keystroke Applescript Actions
OS X has standard keyboard shortcuts for a wide range of common operations: cut (command-x), copy (command-c), paste (command-v), new document (command-n) etc. any of which can be made into a Quicksilver action using a simple one line AppleScript that duplicates the needed keystrokes. Such AppleScripts can make any keyboard shortcut accessible as an Abracadabra gesture. I also use this approach to make gestures for keystrokes that are unavailable from Apple’s Ink such as the forward delete or the function keys as well as keystrokes that Ink often gets wrong like period, comma, escape, return, quotation marks etc. This minimizes my need for the on-screen keyboard, which I find inconvenient and slow.
Any of the Applescripts shown below can be made into a Quicksilver action by first copying the script into the AppleScript Editor (found in /Applications/Utilities) and then saving the script to any folder that Quicksilver indexes. Many people put scripts in the ~/Library/Scripts folder (which works fine provide you make sure the box for Quicksilver —> Catalog —> Scripts —> Scripts(User) is checked). Then, either restart Quicksilver or rescan the catalog, and the script will be available from the Quicksilver text box. The action Quicksilver offers when the script’s name is entered should be:
QS object: #script name#.scpt
QS action: run
This is the action you should associate with a gesture.
An AppleScripts for keystrokes unaffected by a modifier key, that is where no shift, control, option, or command key is used, are the simplest. An Applescript that keystrokes a comma would look like:
tell application "System Events" to keystroke ","
With suitable replacement of the comma, this sort of script would work for:
Adding a modifier key is not hard. For example, undo (command-z) is performed with
tell application "System Events" to keystroke "z" using command down
This kind of script would work for:
(For those unfamiliar, Make Bigger is typically command - = and Make Smaller is command - –).
Where the key’s character cannot easily be set in quotes, AppleScript allows you to use the key’s number. For example, the number for the delete key is 51. Hence, the AppleScript for the delete key is
tell application "System Events" to key code 51
Just like in the previous section, you can use modifier keys as in this script for double quotes:
tell application "System Events" to key code 39 using shift down
With this keyboard as a reference for key codes,
It is straightforward to build AppleScripts for any of the following:
In principle, return and escape could also be approached this way, but to afford the broadest use of these keystrokes — like trying to escape Front Row or some other full screen application — they should be dealt with a bit differently. However, as we’ve done gone through quite a lot already, let’s save that for a later forum article.
For more gestures and associated AppleScripts, checkout the forum thread: AppleScripts for Abracadabra Gestures in the "Tips, Tricks and Scripts" section.
Update: Dec. 31, 2009. After assisting someone in setting up Quicksilver with Abracadabra, I realize that I've failed to mention something important. In order to use AppleScripts that involve GUI scripting (as most of my AppleScript do), one must enable access for assistive devices. Simply open System Preferences and click on the Universal Access preference pane. Then, make sure the box for "Enable access for assistive devices" at the bottom is checked.