Last active
July 19, 2022 01:47
-
-
Save ryan6416/01d58d53633065b77227647f39c5a54d to your computer and use it in GitHub Desktop.
applescript_youtube_music_control_for_chrome
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 argv | |
| 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 (title of currTab) contains "Youtube Music" then set musicTab to currTab | |
| end try | |
| end repeat | |
| tell musicTab to execute javascript "(document.querySelector('[aria-label=\"Next song\"]')).click();" | |
| end tell | |
| end run |
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 argv | |
| 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 (title of currTab) contains "Youtube Music" then set musicTab to currTab | |
| end try | |
| end repeat | |
| tell musicTab to execute javascript "(document.querySelector('[id=\"play-pause-button\"]')).click();" | |
| end tell | |
| end run |
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 argv | |
| 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 (title of currTab) contains "Youtube Music" then set musicTab to currTab | |
| end try | |
| end repeat | |
| tell musicTab to execute javascript "(document.querySelector('[aria-label=\"Previous song\"]')).click();" | |
| end tell | |
| end run |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment