Skip to content

Instantly share code, notes, and snippets.

@whobutsb
Created June 7, 2018 02:42
Show Gist options
  • Save whobutsb/c5378eeb7ecb6d87506f3b7ee8f9039e to your computer and use it in GitHub Desktop.
Save whobutsb/c5378eeb7ecb6d87506f3b7ee8f9039e to your computer and use it in GitHub Desktop.
AppleScript to Play and Pause SoundCloud
on alfred_script(q)
tell application "Google Chrome"
set allWins to every window
set allTabs to {}
repeat with currWin in allWins
set allTabs to allTabs & every tab of currWin
end repeat
repeat with currTab in allTabs
try
if (URL of currTab) starts with "https://soundcloud.com" or "http://soundcloud.com" then set musicTab to currTab
end try
end repeat
tell musicTab to execute javascript "document.querySelector('.playControl').click();"
end tell
end alfred_script
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment