Skip to content

Instantly share code, notes, and snippets.

@nizmow
Created August 12, 2014 01:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nizmow/e62ee4aea45bf615240c to your computer and use it in GitHub Desktop.
Save nizmow/e62ee4aea45bf615240c to your computer and use it in GitHub Desktop.
AppleScript for toggling Play/Pause in Plex Web
tell application "Safari"
repeat with theWindow in (get every window)
repeat with currTab in theWindow's tabs
if name of currTab is equal to "Plex" then
do JavaScript "require(['plex/base/utils/Dispatcher'], function(t) { t.trigger('shortcut:playPause') });" in currTab
end if
end repeat
end repeat
end tell
@nizmow
Copy link
Author

nizmow commented Aug 12, 2014

Bind this to a service and a global hotkey and you're emulating media keys for a web application. Unfortunately I can't see any way to bind it to the actual play/pause hotkey -- you'd need a real Mac application to take over that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment