Things 3 is out!

My favorite to-do-list manager that I keep returning to has gotten the long awaited update!
Things 3 from Cultured Code is out.

I have been using the beta for a while now and just love the application. Things 3 has plenty of features, but also a gorgeous and clean interface.

You can download a trial for the Mac version from their website. You can purchase the Mac, iPhone and iPad versions from the respective AppStores. Currently the app is on 20% introductory sale until May 25.

Check Python Syntax in BBEdit with flake8

There are existing scripts out there that will run flake8 against a python file in BBEdit, but none of them worked quite the way I wanted. So here is mine:

Before you can run this, you need to install flake with sudo easy_install flake8. Then you need to drop this script in ~/Library/Application Support/BBEdit/Scripts. You can launch it from the menu with the script icon.

Start Screen Sharing or Apple Remote Desktop Sessions with Spotlight

Screen Sharing is a really useful tool in Mac OS X. Most people use it locally and select the Computer from the Sharing area in the Finder sidebar. You can also connect Screen Sharing to a remote host. In Finder select “Connect to Server” from the “Go” menu and enter

vnc://host.example.com/

which will connect Screen Sharing to the address.1

You could add the vnc URI to the favorites in the “Connect to Server” dialog, but there is a better way: Screen Sharing remembers the last connections in ~/Library/Application Support/Screen Sharing/. There you will find the hosts you have connected to as .vncloc files. Find the host(s) you use most frequently and copy them to the Desktop or your Documents folder.2 Then rename them to just the hostname or another descriptor. You can now double-click to initiate the Screen Sharing connection. But even better: you can invoke Spotlight, start typing the hostname and the vncloc file should be right there. No matter what you are doing the remote session is just a few keystrokes away.

However, if you prefer to use Apple Remote Desktop over Screen Sharing, this will not work. ARD does not open vncloc files. However, ARD is scriptable, so we can build a workaround. Even better ARD supports Automator, so we don’t even need to write code.

  • open Automator. From the template chooser, select “Application.”
  • add the action “Choose Remote Computer” and select a computer to connect to.3
  • add the “Observe Computers” action next.4
  • you’re done. Save this Automator applet and give it the name of the computer.
  • you can start this applet by starting to type the computer’s name in Spotlight and you will a remote observe session in Remote Desktop.

Create more applets for each host you frequently use. if you select multiple computers in the first action, you will get the nice “multi observe” window in Remote Desktop. Or you can replace the “Choose Remote Computers” action with a “Choose Computer Lists” action.


  1. It will use VNC on TCP port 5900 in case you have connection issues.
  2. anywhere Spotlight will index
  3. The computer has to be already known to the local Remote Desktop to appear in this list.
  4. curiously enough there is no “Control Computers” action, but switching from observe to control is only a single click. This may be so you cannot accidentally invoke a remote control session.

Automatically connect to Airfoil Speakers

Update: In one of those embarrassing “You know there is a checkbox for that!?” moments, @rogueamoeba points out there is in fact a checkbox for this under Preferences “Automatically Transmit To:”


Airfoil from Rogue Amoeba is a wonderful application that allows you to stream audio from your computer to any device that will receive Airplay audio or run the Airfoil Speaker application. This includes all iOS devices. I use it stream audio to any room I may be in where I just hook an iPod touch or the iPhone up to the stereo.

The one drawback is the UI, which only allows to the devices to stream to on the Mac that is streaming. So I’ll be in the kitchen, where a 1G iPod touch is permanently hooked up to some speakers, turn on the iPod touch, start the Airfoil speakers app, then walk to the Mac in the living room, select the iPod touch in the Kitchen and walk back to enjoy the music. Wouldn’t it be great if Airfoil automatically picked up the iPod when it appears in the list?

Luckily Airfoil has AppleScript support. It is actually very easy. I have named all my iOS device to start with either “iPhone”, “iPad” or “iPod touch” so I can make Airfoil connect to all devices that are running the Airfoil app with

tell application "Airfoil"
    connect to every speaker whose name starts with "iP"
end

Now we need to keep running this command periodically in the background. I could setup a launchd plist for that, but AppleScript provides a simpler solution. Scripts that are saved as “Stay Open Applications” have an idle handler that is called after a certain number of seconds. See the details at the AppleScript Language Guide here.

So we wrap the command in an idle handler and add some checking to see if Airfoil is running so we don’t force launch Airfoil:

property idleTime : 30 -- in seconds

on run
	idle -- call idle on launch
end run

on idle
	tell application "System Events"
		if exists application process "Airfoil" then -- check if Airfoil is running
			tell application "Airfoil"
				connect to (every speaker whose name starts with "iP" and connected is false)
			end tell
		else -- if Airfoil is not running script can quit, too
			tell me to quit
		end if
	end tell
	
	return idleTime
end idle

The value returned from the idle handler is the time (in seconds) until it gets called again. This will leave other speakers (that don’t start with “iP”) such as the local speakers and any Airport Express speakers unaffected.

Save this as an application and make sure to select the “Stay Open” option. Then find the application and double click to launch. Start and quit Airfoil speakers app on your iOS devices and listen to Airfoil connect automatically.

iChat Notification with Growl

So there you are doing your work and of course being the geeks that we all are you have about three hundred windows open, give or take a few hundred. Then the iChat icon starts bouncing…

Now you might be very organized and have the iChat window in a certain spot on the screen or even on a certain space in Spaces. You might be a whiz with Exposé and immediately find the right iChat window in the myriad of windows that are open. Or you might have one or two 27″ displays and not really care about this.

But for the rest us, wouldn’t it be nice if say a small window floated into the screen with a notification and the person who sent the message and maybe even the message? And it would have to be unobtrusive and float away just as quickly. You could glance at the notification and decide there and then wether it is necessary to dig out that iChat window.

Incidentally, this is what Growl really does well.

This window will float serenely in front of everything for a few seconds.

And with the scripting interface in iChat it is fairly simple to set up. After installing Growl, take this script:

property growlAppName : "Growl iChat"

property notificationNames : {"Buddy Became Available", ¬
	"Buddy Became Unavailable", ¬
	"Message Received", ¬
	"Completed File Transfer"}
property defaultNotificationNames : {"Buddy Became Available", ¬
	"Buddy Became Unavailable", ¬
	"Message Received", ¬
	"Completed File Transfer"}

using terms from application "iChat"

	on buddy became available theBuddy
		my registerWithGrowl()

		tell application "iChat"
			tell theBuddy
				set theTitle to full name & " became available"
				set theDesc to status message
				set theIcon to image
			end tell
		end tell
		my notify(theTitle, theDesc, theIcon, "Buddy Became Available")
	end buddy became available

	on buddy became unavailable theBuddy
		my registerWithGrowl()

		tell application "iChat"
			tell theBuddy
				set theTitle to full name & " went away"
				set theDesc to status message
				set theIcon to image
			end tell
		end tell
		my notify(theTitle, theDesc, theIcon, "Buddy Became Unavailable")
	end buddy became unavailable

	on message received theText from theBuddy for theTextChat
		my registerWithGrowl()

		tell application "iChat"
			set theIcon to image of theBuddy
			set theTitle to full name of theBuddy
		end tell
		my notify(theTitle, theText, theIcon, "Message Received")
	end message received

	on completed file transfer theTransfer
		my registerWithGrowl()
		tell application "iChat"
			tell theTransfer
				if transfer status is finished then
					if direction is incoming then
						set theTitle to "Received File "
						set theDesc to "from "
					else
						set theTitle to "Sent File "
						set theDesc to "to "
					end if

					set theTitle to theTitle & (file as string)
					set theDesc to theDesc & full name of buddy
				end if
			end tell
		end tell
		my notify(theTitle, theDesc, theIcon, "Message Received")
	end completed file transfer
end using terms from

on registerWithGrowl()
	tell application "GrowlHelperApp"
		register as application growlAppName all notifications notificationNames default notifications notificationNames icon of application "iChat"
	end tell
end registerWithGrowl

on notify(theTitle, desc, icondata, notificationName)
	tell application "GrowlHelperApp"
		if icondata is "" or icondata is missing value then
			notify with name notificationName title theTitle description desc application name growlAppName icon of application "iChat"
		else
			notify with name notificationName title theTitle description desc application name growlAppName image icondata
		end if
	end tell
end notify

Copy the code into AppleScript Editor and save the file as “Growl iChat” (as a script file) in ~/Library/Scripts/iChat/

In iChat, go to Preferences -> Alerts and select the Event “Message Received”, check “Run Applescript” and choose “Growl iChat.scpt”

I also setup the script to react to “Buddy Becomes Available,” “Buddy Becomes Unavailable” and “File Transfer Completed.” The great thing is that you don’t have to enable all notifications. You can even set it up individually so that you get notifications for some buddies, but not others. It should be easy to adapt the script to more actions if you wanted to.