AppleScript and Spotify

Discussion in 'Mac Programming' started by ppcg4mac, Mar 31, 2012.

  1. macrumors 6502

    ppcg4mac

    Joined:
    Feb 13, 2012
    Location:
    Somewhere Else
    #1
    I have been trying to make some applets that control Spotifys music playback, i have don this with itunes before. When i make the play/pause one it says that playpause is not recognized, yet it is in the Apps dictionary. Can someone help me on this.

    what im typing is this.
    Code:
    tell application "Spotify"
    playpause
    end tell
    
    why is this not working here?
     
  2. macrumors 6502a

    Joined:
    Mar 17, 2012
    Location:
    Belgium
    #2
    Look at Spotify AppleScript dictionary

    Take a look at the Spotify dictionary in scripteditor to see
    how to use it with Applescript.

    Found this on Google :

    PlayPause.scpt :

    Code:
    tell application "System Events"
    	set MyList to (name of every process)
    end tell
    if (MyList contains "Spotify") is true then
    	tell application "Spotify.app" to «event spfyPlPs»
    end if
    NextTrack.scpt :

    Code:
    tell application "System Events"
    	set MyList to (name of every process)
    end tell
    if (MyList contains "Spotify") is true then
    	tell application "Spotify.app" to «event spfyNext»
    end if
    PreviousTrack.scpt :

    Code:
    tell application "System Events"
    	set MyList to (name of every process)
    end tell
    if (MyList contains "Spotify") is true then
    	tell application "Spotify.app" to «event spfyPrev»
    end if
    Disclaimer : I don't use Spotify so I couldn't test these scripts.
     

Share This Page