Hi everyone, english is not my first language so forgive any mistakes.
I use Opera and to to control the playback speed of youtube videos I have an extension that allows me to do so, by pressing NumpadAdd and NumpadSub, but I want to do the same by just moving my mouse wheel WHEN MY MOUSE POINTER IS OVER A YOUTUBE VIDEO (is that even possible for AutoHotKey?), because I still want to scroll up and down the page to for example read the comments, you get me right?
This is the script I have, and even though it's not want I want, it still doesn't work:
SetTitleMatchMode 2
#IfWinActive YouTube
WheelDown::NumpadSub
WheelUp::NumpadAdd
YouTube Playback Speed - Mouse Wheel
-
- Posts: 7
- Joined: 23 Feb 2017, 19:14
YouTube Playback Speed - Mouse Wheel
Last edited by keyleoxauto on 23 Feb 2017, 19:37, edited 1 time in total.
Re: YouTube Playback Speed - Mouse Wheel
You'd need a way to know if your mouse is overtop the video itself or not. AHK and Opera probably don't have the best way to do that. If you're lucky, Opera creates a Control that Window Spy can see. Window Spy is included in your download of AHK - right click on any running script's tray icon (by the system clock) and select Window Spy.
I don't think AHK will be a solution for you to get exactly what you want. Instead, you'd probably need to write an extension yourself to activate those in-page hotkeys like that extension is doing but with a detection for if you are moused over the video. Javascript alone might be what you want, detecting WebPage Elements on MouseOver and creating hotkeys dynamically. No idea how to do that.
Alternatively, you can try using hotkeys to toggle on and off that action though, like pressing the MButton:
I don't think AHK will be a solution for you to get exactly what you want. Instead, you'd probably need to write an extension yourself to activate those in-page hotkeys like that extension is doing but with a detection for if you are moused over the video. Javascript alone might be what you want, detecting WebPage Elements on MouseOver and creating hotkeys dynamically. No idea how to do that.
Alternatively, you can try using hotkeys to toggle on and off that action though, like pressing the MButton:
Code: Select all
#If ; no context-sensitivity
MButton::toggle:=!toggle
#If toggle ; or #If (toggle) && WinActive("YouTube") with a prior set SetTitleMatchMode, 2
WheelDown::NumpadSub
WheelUp::NumpadAdd
-
- Posts: 7
- Joined: 23 Feb 2017, 19:14
Re: YouTube Playback Speed - Mouse Wheel
Hey that last thing works man! Sorry I call it "thing" but I know very little about AHK and scripts.Exaskryz wrote:You'd need a way to know if your mouse is overtop the video itself or not. AHK and Opera probably don't have the best way to do that. If you're lucky, Opera creates a Control that Window Spy can see. Window Spy is included in your download of AHK - right click on any running script's tray icon (by the system clock) and select Window Spy.
I don't think AHK will be a solution for you to get exactly what you want. Instead, you'd probably need to write an extension yourself to activate those in-page hotkeys like that extension is doing but with a detection for if you are moused over the video. Javascript alone might be what you want, detecting WebPage Elements on MouseOver and creating hotkeys dynamically. No idea how to do that.
Alternatively, you can try using hotkeys to toggle on and off that action though, like pressing the MButton:
Code: Select all
#If ; no context-sensitivity MButton::toggle:=!toggle #If toggle ; or #If (toggle) && WinActive("YouTube") with a prior set SetTitleMatchMode, 2 WheelDown::NumpadSub WheelUp::NumpadAdd
It's not exactly what I wanted (I have an extra step to do with MButton) but it works, so for now I'll take it. Thanks!
Re: YouTube Playback Speed - Mouse Wheel
Wouldn't something like this work ?? ( UNTESTED )keyleoxauto wrote: Hey that last thing works man! Sorry I call it "thing" but I know very little about AHK and scripts.
It's not exactly what I wanted (I have an extra step to do with MButton) but it works, so for now I'll take it. Thanks!
Code: Select all
WheelDown::
WinGetActiveTitle title
if(InStr(title, "Youtube - Google Chrome")) {
send (NumpadSub)
}
Return
-
- Posts: 7
- Joined: 23 Feb 2017, 19:14
Re: YouTube Playback Speed - Mouse Wheel
4GForce wrote:Wouldn't something like this work ?? ( UNTESTED )keyleoxauto wrote: Hey that last thing works man! Sorry I call it "thing" but I know very little about AHK and scripts.
It's not exactly what I wanted (I have an extra step to do with MButton) but it works, so for now I'll take it. Thanks!Edit: you might wanna replace google chrome by opera something whatever the window title isCode: Select all
WheelDown:: WinGetActiveTitle title if(InStr(title, "Youtube - Google Chrome")) { send (NumpadSub) } Return
Thanks 4GForce I tried but it doesn't work. I even change the title to YouTube - Opera and then to only Youtube.
Exaskryz I now have a problem, as long as I have a YouTube tab open, I can´t use MButton in other tabs to open links in new tabs for example, or close tabs (that's too many tabs haha) so I was wondering, is there a way to edit the script so the MButton toggle thing only works on a YouTube active tab?Exaskryz wrote:You'd need a way to know if your mouse is overtop the video itself or not. AHK and Opera probably don't have the best way to do that. If you're lucky, Opera creates a Control that Window Spy can see. Window Spy is included in your download of AHK - right click on any running script's tray icon (by the system clock) and select Window Spy.
I don't think AHK will be a solution for you to get exactly what you want. Instead, you'd probably need to write an extension yourself to activate those in-page hotkeys like that extension is doing but with a detection for if you are moused over the video. Javascript alone might be what you want, detecting WebPage Elements on MouseOver and creating hotkeys dynamically. No idea how to do that.
Alternatively, you can try using hotkeys to toggle on and off that action though, like pressing the MButton:
Code: Select all
#If ; no context-sensitivity MButton::toggle:=!toggle #If toggle ; or #If (toggle) && WinActive("YouTube") with a prior set SetTitleMatchMode, 2 WheelDown::NumpadSub WheelUp::NumpadAdd
Re: YouTube Playback Speed - Mouse Wheel
I had a comment that alludes to that. What you may want then is to use this code:
Code: Select all
SetTitleMatchMode, 2
#IfWinActive YouTube
MButton::toggle:=!toggle
#If (toggle) && WinActive("YouTube")
WheelDown::NumpadSub
WheelUp::NumpadAdd
#If ; resets context-sensitivity for any other hotkeys you may have
-
- Posts: 7
- Joined: 23 Feb 2017, 19:14
Re: YouTube Playback Speed - Mouse Wheel
Exaskryz wrote:I had a comment that alludes to that. What you may want then is to use this code:
Code: Select all
SetTitleMatchMode, 2 #IfWinActive YouTube MButton::toggle:=!toggle #If (toggle) && WinActive("YouTube") WheelDown::NumpadSub WheelUp::NumpadAdd #If ; resets context-sensitivity for any other hotkeys you may have
It doesn't work at all now.
I think that this: "SetTitleMatchMode, 2 #IfWinActive YouTube" is not working
What about pressing RButton while moving the mouse wheel up (NumpadAdd) and down (NumpadSub)?
Re: YouTube Playback Speed - Mouse Wheel
Did you make sure your SetTitleMatchMode, 2 was in the auto-execute section?
As for your alternative idea, you could try this:
Or just do a combination hotkey, and depending on your use case, with the ~ modifier.
As for your alternative idea, you could try this:
Code: Select all
#If GetKeyState("RButton","P") ; if RButton is physically held
WheelDown::NumpadSub
WheelUp::NumpadAdd
#If ; reset context-sensitivity
Code: Select all
~RButton & WheelUp::Send {NumpadAdd}
~RButton & WheelDown::Send {NumpadSub}
Re: YouTube Playback Speed - Mouse Wheel
It might be more easy to use GreaseMonkey/Tampermonkey for this.
Focusing our efforts on non-productive and non-creative endeavours wastes lives as surely as war.
Jacque Fresco / The best that money can't buy
Jacque Fresco / The best that money can't buy
Who is online
Users browsing this forum: NinjoOnline and 286 guests