Sunday Nerd Out: Apple Scripts in Quicksilver

Well, it’s not been a good day; my less-than-six-month-old PowerBook appears to have eaten its hard drive.

The good news is that between moving everything up to Google Docs/Gmail/Google Calendar and doing hourly Time Machine back ups very little has been lost (though, I hadn’t done a Time Machine back up since Friday night). Knock Wood.

I’m using Marci’s MacBook until my appointment tomorrow with the ill-advisedly named “Geniuses” at the Apple Store. This requires me to get her machine to operate the way I like my machine to operate, which essentially means installing Quicksilver and getting my Triggers going.

Perhaps in a feeble attempt to overcome feeling helpless about my hard drive dying I decided to solve a problem I’ve had with Quicksilver that’s been bugging me for some time: my inability to figure out how to hide apps using a trigger.

Opening an app with a trigger is as easy as can be:

1. Pull up QS
2. hit command “;” to get to the preferences
3. go to Triggers
4. hit the “+” key
5. access the app you want to open in the top panel
6. tab to the second, “Action,” panel and (if it doesn’t already display it) hit “O” to coax the “Open” command to appear in the Action panel
7. Hit Save and then click on the Trigger section and put whatever keystroke you want as the trigger (if, like I do, you want to use the Function keys (F1, etc.), you’ll need go to the “Keyboard and Mouse” System Preference panel and check the box that says, “Use all F1, F2 keys as standard function keys”)

You can now use the function keys to pull up pretty much whatever you want; for me F1 pulls up Safari, F2: Firefox, F3: Tweetie, etc.

The problem I wanted to solve is that I’d like to be able to quickly hit a modified function key to hide these apps. For instance, I wanted to be able to hit [Command F1] to hide Safari after I’d used “F1” to pull it up.

You’d think that’d be easy, and there may be an easier way than what I’ve come up with, but a little apple scripting goes a long way here.

To hide any app do the following:

1. Pull up QS as described above in steps 1 thru 4
2. Now in the top panel (“Select an item”) of QS type a period: “.” – this tells QS that you want to enter text
3. Use the following script and substitute whatever app you want to hide for where I have “Safari”:

tell application “System Events” to tell process “Safari” to set visible to false

4. You’ll note that as soon as QS realizes you’re putting a script into its first panel (via the words “tell application”) the second (“Action”) panel changes to “Run as AppleScript
5. Hit Save
6. As above, in Step 7, click on the keystroke area and enter in whatever key or key combination you want to use to, in this case, hide “Safari.” As I’ve said, I use a modifier of the key I use to open, so F1 opens safari and [command + F1] hides it

This may seem like a lot of trouble, but I promise you, those actions of moving your hands from your keyboard to your mouse and back again add up.

Tags: , ,


Your email address will not be published. Required fields are marked *