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!

One thought on “More fun with applescript; a play/pause button for Mixcloud

  1. This is dope! You’ve got a new subscriber to the blog 🙂

    I actually found this post because upon just recently upgrading to Mojave, I noticed (at least in Safari) that the play/pause button was recognized by Mixcloud automatically, and upon googling, apparently the media button now prioritizes Safari even over iTunes, which might actually be pretty annoying in some circumstances. I also use Fluid apps to run Mixcloud and Soundcloud, and I find that in pinned mode this is super convenient. ‘F6’ on my Apple wireless keyboard is unused, so I drew a music note on it with Sharpie, and bind that to the Fluid apps, and if both are open, it will alternate between them, which is non disruptive, and they don’t need to occupy much space while open since they are just music players… Fluid is just so awesome!

    I need to update it more, but I keep a repo with some cool stuff for Fluid apps here, if there is any interest:

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s