Spotify Applescripts – Updated

New Version Here
picture-2As with all good things there comes a time when a little update and a refresh is needed. Sometime ago a released several little Applescript helpers that let you control spotify through Quicksilver triggers. However they had a little tendency to make spotify the front and therefore active app when you used them. The new and improved scripts will return you back to the app you where using before the script was triggered, fun eh!


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 5 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 5 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 5 of menu bar 1
		end tell
	end tell
	tell application "System Events"
		set visible of process "Spotify" to false
	end tell
end if

4 Replies to “Spotify Applescripts – Updated”

Leave a Reply