Action to control Spotify only

You can do this with an applescript action!

The code is easy, something like:

tell application "Spotify" to playpause

The code I use is a bit more complicated. It won't open spotify randomly and it also stabilises the action so that if an error happens it'll be fine.

--control Spotify playback directly and not something else

if application "Spotify" is running then
	tell application "Spotify"
		try
			playpause
		on error
			return "-"
		end try
	end tell
else
	return "-"
end if

This code is from my preset AquaTouch, which has app-specific play/pause buttons for iTunes, Spotify and YouTube. Check it out!

2 Likes