Controlling Spotify with AppleScript
If you want to play/pause whatever was most recently playing you can use the following scripts. If you save each of them as Automator applications and you can run them from Spotlight or Alfred.
Play:
tell application "Spotify"
play
end tell
Pause:
tell application "Spotify"
pause
end tell
More recent versions of Spotify have added this to the dictionary. For example:
tell application "Spotify"
play track "spotify:album:7ppypgQppMf3mkRbZxYIFM"
end tell
There's currently no way to do this with the current dictionary. We'd like to expand it in the future, but I'm not aware of any concrete plans to do so at the moment.