Created
April 29, 2013 01:59
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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