Rewind and forward YouTube video's even with outfocussed browser (Chrome). Handy for USB Wheel such as Griffin Powermate

Post your working scripts, libraries and tools for AHK v1.1 and older
Sneeuwvos
Posts: 6
Joined: 13 Jan 2018, 05:45

Rewind and forward YouTube video's even with outfocussed browser (Chrome). Handy for USB Wheel such as Griffin Powermate

13 Jan 2018, 05:59

Hi guys,

If you have a USB scrollwheel, such as Griffin PowerMate USB (https://viralgadgets.net/wp-content/upl ... vnqw32.jpg), and have YouTube running in a browser window somewhere, then this will be handy for you.

Normally a USB scrollwheel will only do a certain action, such as: scrolling up/down, volume up/down. But like the PowerMate USB you can also run executables. This is where AutoHotKey comes in.

On my ultra wide screen I have a browser left having YouTube open and a browser right just browsing another site. Whenever I use the wheel I always want to rewind/forward YouTube without first pressing the left browser. So these scripts do that. NetFlix and VLC still work if there is no browser with YouTube open.

Have fun!


SCRIPT FOR SCROLLING YOUTUBE BACKWARD:

Code: Select all

SetTitleMatchMode, 2
WinActivate, YouTube
Send, {Left}
SCRIPT FOR SCROLLING YOUTUBE FORWARD:

Code: Select all

SetTitleMatchMode, 2
WinActivate, YouTube
Send, {Right}
SCRIPT FOR PAUSE/PLAY YOUTUBE:

Code: Select all

SetTitleMatchMode, 2
WinActivate, YouTube
Send, {Space}
SrGeneroso
Posts: 1
Joined: 15 Mar 2021, 13:05

Re: Rewind and forward YouTube video's even with outfocussed browser (Chrome). Handy for USB Wheel such as Griffin Power

15 Mar 2021, 13:51

Awesome, I use it with streamdeck and work pretty well, just try to not have more than one tab in front with youtube in the title, I haven't tested in all setups but it'll do the trick.
I've done some changes and added some more hotkeys.

Code: Select all

ActWin := WinActive("A")
SetTitleMatchMode, 2
WinActivate, YouTube
Send, {K}
WinActivate, ahk_id %ActWin%
First line is to store the current window to reload it after the hotkey is used in youtube
Last line is the restore said window so you don't have to alt tab or click again to recover control of the windows you were using.

then here is the list
PLAY/PAUSE

Code: Select all

Send, {K}
REWIND

Code: Select all

Send, {J}
FORWARD

Code: Select all

Send, {L}
MUTE

Code: Select all

Send, {M}
SPEED UP

Code: Select all

Send, {>}
SPEED DOWN

Code: Select all

Send, {<}
NEXT FRAME (when paused)

Code: Select all

Send, {.}
PREVIOUS FRAME (when paused)

Code: Select all

Send, {,}
VOLUME UP

Code: Select all

Send, {Up}
VOLUME DOWN

Code: Select all

Send, {Down}
FULLSCREEN

Code: Select all

Send, {F}
CLOSED CAPTIONS

Code: Select all

Send, {C}
Thanks for sharing the main functionality and I hope some find it useful.

Return to “Scripts and Functions (v1)”

Who is online

Users browsing this forum: gwarble, manbat42, MiM and 65 guests