Skip to content

Instantly share code, notes, and snippets.

@jakemauer
Created March 16, 2012 07:26
Show Gist options
  • Select an option

  • Save jakemauer/2049001 to your computer and use it in GitHub Desktop.

Select an option

Save jakemauer/2049001 to your computer and use it in GitHub Desktop.
Keyboard music playback key Applescripts
if appIsRunning("spotify") then
tell application "Spotify"
playpause
end tell
else if appIsRunning("iTunes") then
tell application "iTunes"
playpause
end tell
end if
on appIsRunning(appName)
tell application "System Events" to (name of processes) contains appName
end appIsRunning
if appIsRunning("spotify") then
tell application "Spotify"
previous track
end tell
else if appIsRunning("iTunes") then
tell application "iTunes"
previous track
end tell
end if
on appIsRunning(appName)
tell application "System Events" to (name of processes) contains appName
end appIsRunning
if appIsRunning("spotify") then
tell application "Spotify"
next track
end tell
else if appIsRunning("iTunes") then
tell application "iTunes"
next track
end tell
end if
on appIsRunning(appName)
tell application "System Events" to (name of processes) contains appName
end appIsRunning
tell application "iTunes"
if player state is paused then play
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment