More fun with applescript; a play/pause button for Mixcloud

I’ve been using Mixcloud in the office lately. Progressive house mixes are quite nice for work as they are long and not very distracting. However, when something does catch my attention it’s a pain to find the tab and click on the big “pause” button. The solution only took a minute or two:

#! /usr/bin/osascript
tell application "Mixcloud"
end tell

tell application "System Events"
tell process "Mixcloud"
keystroke space
end tell
end tell

This requires the Mixcloud website to be wrapped into an individual application, which is easily accomplished via Fluid. Doing this also has the advantage protecting the music from stuttering when single-threaded Safari is suffering under load.

Finally, the script is bound to shift+F4 using Quicksilver. (It needs to be saved with the “.applescript” extension for quicksilver to recognise it as an executable script.) A few other fun keybindings I use are F4 for iTunes play/pause, F3 to open a periodic table and F6 to open a de-stressing Google Image Search for fluffy kittens.

It would be an improvement if F4 could detect whether iTunes or Mixcloud is playing and start/stop them intelligently. Suggestions are welcome!