I have a strange problem I can't figure out. I've created a service in Automator to control Google Play Music within a Chrome window when it is currently playing a song. I have play/pause controls listed in the following Service code:
The strange thing is, this service works fine from within Automator (clicking on Run results in the intended function taking place in the browser, regardless of the fact that the browser is not in focus.) However, when I map it to a keyboard shortcut, or if I select it from the Menu bar ("Chrome" --> "Services" --> "Google Play PlayPause"), the service has no effect.
I can't seem to figure out why I cannot get the service to work outside of Automator itself. Can anyone help?
Code:
on run
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 "My Music - Google Play" then set musicTab to currTab
end try
end repeat
tell musicTab to execute javascript "SJBpost('nextSong');"
end tell
end run
The strange thing is, this service works fine from within Automator (clicking on Run results in the intended function taking place in the browser, regardless of the fact that the browser is not in focus.) However, when I map it to a keyboard shortcut, or if I select it from the Menu bar ("Chrome" --> "Services" --> "Google Play PlayPause"), the service has no effect.
I can't seem to figure out why I cannot get the service to work outside of Automator itself. Can anyone help?