Spotify Applescripts Version 0.4.3

archived from the old blog ·

NEW! Updated version of the Applescripts available here
With the new version of Spotify the menus have been moved around, so I have updated the Applescripts that you can use to control Spotify with Quicksilver.
Play Next

tell application "System Events"
	set MyList to (name of every process)
end tell

tell application "System Events" to set appList to ¬
	name of application processes whose frontmost is true

set activeApp to item 1 of appList
if (MyList contains "Spotify") is true then
	tell application "Spotify" to activate
	tell application "System Events"
		tell process "Spotify"
click menu item 3 of menu 1 of menu bar item 6 of menu bar 1
		end tell
	end tell
	tell application "System Events"
		set visible of process "Spotify" to false
	end tell
end if

Play Previous

tell application "System Events"
	set MyList to (name of every process)
end tell

tell application "System Events" to set appList to ¬
	name of application processes whose frontmost is true

set activeApp to item 1 of appList
if (MyList contains "Spotify") is true then
	tell application "Spotify" to activate
	tell application "System Events"
		tell process "Spotify"
click menu item 4 of menu 1 of menu bar item 6 of menu bar 1
		end tell
	end tell
	tell application "System Events"
		set visible of process "Spotify" to false
	end tell
end if

Play/Pause

tell application "System Events"
	set MyList to (name of every process)
end tell

tell application "System Events" to set appList to ¬
	name of application processes whose frontmost is true

set activeApp to item 1 of appList
if (MyList contains "Spotify") is true then
	tell application "Spotify" to activate
	tell application "System Events"
		tell process "Spotify"
click menu item 1 of menu 1 of menu bar item 6 of menu bar 1
		end tell
	end tell
	tell application "System Events"
		set visible of process "Spotify" to false
	end tell
end if