Help With Youtube Player Focus Script

Get help with using AutoHotkey and its commands and hotkeys
leo007
Posts: 50
Joined: 26 Oct 2019, 04:56

Help With Youtube Player Focus Script

16 Dec 2019, 06:59

Hi Everyone,
I need help in script for chrome that focus on youtube player when youtube page get open.
so that I could hit spacebar, right/left to navigation and Up/Down for volume control without having left mouse click on player itself.

I made a small script that partially works, spacebar, right, left to navigation
but no volume Up / Down control and its not automated.

Code: Select all


SetTitleMatchMode, 2      
#ifWinActive YouTube        
  !a:: SendInput, {Tab 3} 
  
  Return
#ifWinActive
	
I will be grateful for sharing script modification
much thanks in advance)
AHKStudent
Posts: 898
Joined: 05 May 2018, 12:23

Re: Help With Youtube Player Focus Script

16 Dec 2019, 07:44

Code: Select all

SetTitleMatchMode, 2      
#ifWinActive YouTube        
  q:: SendInput, {Up} 
  w:: SendInput, {Down} 
  Return
#ifWinActive
leo007
Posts: 50
Joined: 26 Oct 2019, 04:56

Re: Help With Youtube Player Focus Script

16 Dec 2019, 08:10

AHKStudent thanks for reply and script.
this script variation don't solve the volume focus

Code: Select all

  q:: SendInput, {Up} 
  w:: SendInput, {Down} 
because {Up} and {Down} aren't get focus to trigger a volume change
leo007
Posts: 50
Joined: 26 Oct 2019, 04:56

Re: Help With Youtube Player Focus Script

16 Dec 2019, 09:28

I made this simple script that get all controls right. but the down side is fixed hard codded screen resolution and its get triggered a bit slow because the necessary move delay.
and its not automated.

Code: Select all


  SetTitleMatchMode, 2
  #ifWinActive YouTube
    !a::
      MouseGetPos, x, y

      if(A_ScreenWidth == 1680)
          Click, 600, 400, 1
      else
          Click, 745, 420, 1

      Sleep, 200
      SendInput, {Space}
      MouseMove, x, y, 0
    Return
  #ifWinActive

AHKStudent
Posts: 898
Joined: 05 May 2018, 12:23

Re: Help With Youtube Player Focus Script

16 Dec 2019, 09:34

leo007 wrote:
16 Dec 2019, 08:10
AHKStudent thanks for reply and script.
this script variation don't solve the volume focus

Code: Select all

  q:: SendInput, {Up} 
  w:: SendInput, {Down} 
because {Up} and {Down} aren't get focus to trigger a volume change
up and down are the shortcuts to increase or decrease the volume on youtube, but maybe you have specific needs that demand you click the actual volume control
leo007
Posts: 50
Joined: 26 Oct 2019, 04:56

Re: Help With Youtube Player Focus Script

16 Dec 2019, 12:48

I guess I mislead you somehow or you didn't understood my situation. I absolutely agree when you saying
AHKStudent wrote: up and down are the shortcuts to increase or decrease the volume on youtube, but maybe you have specific needs that demand you click the actual volume control
the problem is neither of Up/Down won't work until YouTube player will be focused by mouse clicking on video area.
so it doesn't matter which of key would trigger up/down until video player won't be focused none of them would work.
and I'm trying to get script that focus on the youtube video player with Up/Down keys working.
my partial solution as I posted above simulating the click, and it work right.
but because of some disadvantages I'm looking for more efficient script solution then mine.

Return to “Ask For Help”

Who is online

Users browsing this forum: Ferro, Google [Bot], mikeyww, roadcone, Yoonutz and 43 guests