Skip to content

Instantly share code, notes, and snippets.

@chmurph2
Created September 17, 2017 13:12
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 chmurph2/1f606f1bafff9b729bf6ce77a9a20421 to your computer and use it in GitHub Desktop.
Save chmurph2/1f606f1bafff9b729bf6ce77a9a20421 to your computer and use it in GitHub Desktop.
AppleScript Audio: Go to Current Playing Track
# Goes to iTunes or Spotify (in that order of priority), shows the currently playing track.
if appIsRunning("iTunes") then
tell application "iTunes" to activate
try
tell application "System Events"
tell process "iTunes"
tell menu bar 1 to pick menu item "Go to Current Song" of menu "Controls"
end tell
end tell
end try
else if appIsRunning("Spotify") then
tell application "Spotify" to activate
end if
on appIsRunning(appName)
tell application "System Events" to (name of processes) contains appName
end appIsRunning
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment