Colin Sullivan

Convenience with Quicksilver

For the past few years I have been using Quicksilver for OS X, an application which has dramatically changed the way many people get things done on their Mac. Here are a few things you can do fairly easily (if you want to be as cool as me).

Fast Websearches

With the Quicksilver web search plugin, all you need to do to use Google (or any other site with a search form) is activate Quicksilver (my shortcut is ctrl-space), start typing "google" until it shows up, press tab-tab, type your search, and press return. Check out the video below to see what I mean.

The plugin comes loaded with typical sites, but to be able to use this plugin with any website, just search for "***" on the page and bookmark the result (make sure Quicksilver is indexing your bookmarks).

Here I am searching google for "weather 12180", and then getting a map from Troy to the Albany airport.

Bookmarks with Firefox 3.5

To get Quicksilver to index your bookmarks in newer versions of Firefox, you have to change a Firefox setting so it creates legacy bookmark data upon quit. Here's how.

Quicksilver Tweets

To use Twitter from Quicksilver, I activate Quicksilver and press period to enter text entry mode, type my tweet, press tab and start typing "tweet" until it shows up as an option, then press return. This sends the message to twitter, which updates my Facebook via the Twitter application for Facebook. The script also updates my iChat status, and gives me a Growl notification of the success. Yes, this one makes me feel super cool.

To set this up, you must add an "Action" to Quicksilver. An action is just an Applescript located in ~/Library/Application Support/Quicksilver/Actions. In this case, it is this file, called "tweet.scpt":

using terms from application "Quicksilver"
on process text tweet
set wordcount to do shell script "echo " & quoted form of tweet & " | wc -c"
set wordcount to do shell script "echo " & quoted form of wordcount & " | sed 's/^[ ]*//'"
if wordcount as integer > 140 then
my growlRegister()
growlNotify("Tweet too long", "(" & wordcount & ") characters")
return nothing
end if
 
tell application "Keychain Scripting"
set twitter_key to first Internet key of current keychain whose server is "twitter.com"
set twitter_login to quoted form of (account of twitter_key & ":" & password of twitter_key)
end tell
set twitter_status to quoted form of ("source=qucs&status=" & tweet)
set results to do shell script "curl --user " & twitter_login & " --data-binary " & twitter_status & " http://twitter.com/statuses/update.json"
-- display dialog results
my growlRegister()
growlNotify("Tweet Sent", tweet)
 

tell application "System Events"
if exists process "iChat" then
tell application "iChat"
set the status message to tweet
end tell
end if
end tell
 
return nothing
end process text
end using terms from
 
using terms from application "GrowlHelperApp"
-- Register Growl
on growlRegister()
tell application "GrowlHelperApp"
register as application "Tweet" all notifications {"Alert"} default notifications {"Alert"}
end tell
end growlRegister
 
-- Notify using Growl
-- Example: growlNotify("This is an Alert","This is a test of the Growl Alert System")
on growlNotify(grrTitle, grrDescription)
tell application "GrowlHelperApp"
notify with name "Alert" title grrTitle description grrDescription application name "Tweet"
end tell
end growlNotify
end using terms from

AppleScript

iTunes Fade Out and Pause

This is my favorite. If you know me, you know I am obsessive about my music collection. I refuse to store anything that is not Lossless, etc. On my Mac, if iTunes is playing, and I press ctrl-alt-cmd-space, iTunes will fade out slowly, then pause. When these commands are pressed again, iTunes will resume playing, and slowly fade in.

This is done using a Quicksilver "trigger". A trigger can be assigned to any keystroke, and can potentially perform any action. In this case, it is running an Applescript, which can be found below.

(*
db iTunes Fade-in/out
By David Battino, Batmosphere.com
Based on ideas from Dougs AppleScripts and Mac OS Hints
 
This script fades out iTunes if it is playing and fades it in if it is stopped.
*)
 
global okflag --Update 2007-06-07: changed from "property okflag : false"
set okflag to false
set front_app to (path to frontmost application as Unicode text) -- So we can switch back to this after running the fade
 
-- check if iTunes is running
tell application "System Events"
if process "iTunes" exists then
set okflag to true --iTunes is running
end if
end tell
 
if okflag is true then
tell application "iTunes"
set currentvolume to the sound volume
if (player state is playing) then
repeat
--Fade down
repeat with i from currentvolume to 0 by -1 --try by -4 on slower Macs
set the sound volume to i
delay 1.0E-3 -- Adjust this to change fadeout duration (delete this line on slower Macs)
end repeat
pause
--Restore original volume
set the sound volume to currentvolume
exit repeat
end repeat
else
set the sound volume to 0 --2007-03-20 script update to fix startup glitch
play
repeat with j from 0 to currentvolume by 1 --try by 4 on slower Macs
set the sound volume to j
delay 1.0E-3
end repeat
end if
end tell
tell application front_app
activate
end tell
end if

AppleScript

Anyone who uses a Mac and would like to be able to accomplish things a bit faster should install Quicksilver. It is free. I do not think there will be anymore official updates to Quicksilver, as the person who developed it is now working on the Google quick search box. You can still download beta updates for Quicksilver here. Last time I checked, the Google QSB did not have advanced features such as triggers, and was merely an application launcher/web search interface.