Last active
August 29, 2015 14:02
-
-
Save dbuezas/8efadf1ee9c282c2d91e to your computer and use it in GitHub Desktop.
This file contains 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
-- Execute -> Install | |
-- Keyboard -> Shortcuts -> Services -> playpause soundcloud -> set your Shortcut | |
set titleString to "" | |
tell application "Google Chrome" | |
activate | |
set window_list to every window # get the windows | |
set the_window_index to 0 | |
repeat with the_window in window_list # for every window | |
set the_window_index to the_window_index + 1 | |
set tab_list to every tab in the_window # get the tabs | |
set the_index to 0 | |
repeat with the_tab in tab_list # for every tab | |
set the_index to the_index + 1 | |
set the_url to URL of the_tab | |
if the_url contains "soundcloud" then | |
set the_previously_active_tab_index to active tab index of the_window | |
set active tab index of the_window to the_index | |
set visible of the_window to false -- to activate the window | |
set visible of the_window to true | |
tell application "System Events" to tell process "Google Chrome" | |
keystroke " " | |
end tell | |
set active tab index of the_window to the_previously_active_tab_index | |
return | |
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