Skip to content

Instantly share code, notes, and snippets.

@Oblongmana
Created April 29, 2013 01:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Oblongmana/5479296 to your computer and use it in GitHub Desktop.
Save Oblongmana/5479296 to your computer and use it in GitHub Desktop.
#Applescript file to control #play / #pause #priority when run. Priority here is: If Quicktime has focus, play/pause in qt; if VLC has focus, play/pause in VLC; otherwise play/pause in Spotify
on run {input, parameters}
tell application "System Events"
set MyList to (name of every process)
end tell
set nameOfFocusedApp to name of (info for (path to frontmost application))
if (MyList contains "QuickTime Player" and nameOfFocusedApp is "QuickTime Player.app") is true then
tell application "QuickTime Player"
tell document 1 to if exists then
if playing then
pause
else
play
end if
end if
end tell
else if (MyList contains "VLC" and nameOfFocusedApp is "VLC") is true then
tell application "VLC" to play
else if (MyList contains "Spotify") is true then
tell application "Spotify" to playpause
end if
return input
end run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment