Created
September 6, 2018 17:45
-
-
Save willhoney7/59a41622b709aff4fdd11d10fb49cfff to your computer and use it in GitHub Desktop.
play/pause youtube via applescript
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
tell application "Google Chrome" | |
set found_video to false | |
set window_list to every window | |
repeat with the_window in window_list | |
if found_video is equal to true then | |
exit repeat | |
end if | |
set tab_list to every tab in the_window | |
repeat with the_tab in tab_list | |
if the title of the_tab contains "- YouTube" then | |
tell the_tab | |
execute javascript "document.querySelector(\"video\").click();" | |
end tell | |
set found_video to true | |
exit repeat | |
end if | |
end repeat | |
end repeat | |
end tell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment