Created
August 2, 2014 17:02
-
-
Save ellcom/58f47d7eeb3601734ef9 to your computer and use it in GitHub Desktop.
Tell spotify to play/pause using AppleScript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using terms from application "Spotify" | |
if player state of application "Spotify" is paused then | |
tell application "Spotify" to play | |
else | |
tell application "Spotify" to pause | |
end if | |
end using terms from |
Another alternative I found in this thread may be of help. It allows execution if play state is either 'playing' or 'paused':
if player state is playing or player state is paused then
E.G
if application "Spotify" is running then
tell application "Spotify"
if player state is playing or player state is paused then
set trackID to (get id of current track)
end if
end tell
end if
Like gcerquant, this could've worked because things have changed over the years. I tried it in Catalina (10.15.7) when working on my own Spotify-Applescript program.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A more simple version is possible (Things might have changed since 7 ! years, ago):