Hello,
I'm visually impaired and use a lot of AHK scripts to aid in my use of my computer. But I have a problem and can use some help...
One thing I would love to automate is finding and clicking the button at the far right of the YouTube video player's control bar. I'm pretty sure there is no Windows handle or id for this control. And I'm pretty sure that I'd need to do an http Send with some command string to ask YouTube to go full screen. But those are just educated guesses,..
If any of you young, super studs can help an old blind guy out with a script to automate taking YouTube videos full screen, I'd be greatly appreciative...
(I have the same issue with Vimeo. I'm guessing if I can see how to do it with YouTube I'll be able to figure out Vimeo...)
Thanks in advance!
Keith
script to full screen YouTube videos
Re: script to full screen YouTube videos
This is the most annoying problem ever. Pressing f works to get fullscreen in Mozilla Firefox and Google Chrome, but not in Internet Explorer.
This works for YouTube in Internet Explorer, but if anyone has any other ideas or knowledge on the subject, I would like to know anything I can about this problem, thanks.
Re. annoying, in the UK at least, when watching playlists, YouTube kept playing the same 3 mini-Tyler Oakley adverts and 1 Lilly Singh advert constantly. This was really awful and so I set up a script to mute YouTube the second I heard one of those ads come on.
==================================================
I couldn't get Vimeo to work, I tried things like:
Like YouTube, f works to set fullscreen on, on Mozilla Firefox and Google Chrome, but doesn't work on Internet Explorer 11.
This works for YouTube in Internet Explorer, but if anyone has any other ideas or knowledge on the subject, I would like to know anything I can about this problem, thanks.
Code: Select all
#IfWinActive, ahk_class IEFrame
;[WBGet function]
;Basic Webpage Controls with JavaScript / COM - Tutorial - Tutorials - AutoHotkey Community
;https://autohotkey.com/board/topic/47052-basic-webpage-controls-with-javascript-com-tutorial/
~f::
WinGet, hWnd, ID, A
oWB := WBGet("ahk_id " hWnd)
if InStr(oWB.document.url, "youtube.com/")
|| InStr(oWB.document.url, "youtu.be/")
{
oWB.document.getElementsByClassName("ytp-fullscreen-button ytp-button").item[0].focus()
;oWB.document.getElementsByClassName("ytp-fullscreen-button ytp-button").item[0].click() ;didn't work
ControlSend, Internet Explorer_Server1, {Enter}, % "ahk_id " hWnd
}
oWB := ""
return
#IfWinActive
==================================================
I couldn't get Vimeo to work, I tried things like:
Code: Select all
oWB.document.getElementsByClassName("fullscreen").item[0].focus()
oWB.document.getElementsByClassName("fullscreen").item[0].click()
oWB.document.getElementsByClassName("fullscreen-icon").item[0].focus()
oWB.document.getElementsByClassName("fullscreen-icon").item[0].click()
Last edited by jeeswg on 22 Jul 2017, 18:42, edited 1 time in total.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
Re: script to full screen YouTube videos
Well that's totally awesome! I have been using Edge just because I like it and it's the default. But I have chrome and Firefox too.
Hopefully someone will add to the discussion with a workaround for IE 11 and/or Edge...
I used to be a programmer. I could follow your code quite easily. Thanks!
Keith
Hopefully someone will add to the discussion with a workaround for IE 11 and/or Edge...
I used to be a programmer. I could follow your code quite easily. Thanks!
Keith
Re: script to full screen YouTube videos
It turns out that with YouTube you can double-click on the video to view it in fullscreen, but I am having trouble trying to invoke double-click on a web element, if anyone has any ideas.
E.g. *not* working, it reacts (toggles play/pause) but doesn't invoke fullscreen:
(dblclick and doubleclick didn't work.)
==================================================
This is a version of the script above for YouTube, but which closes the notification bar via Acc.
E.g. *not* working, it reacts (toggles play/pause) but doesn't invoke fullscreen:
Code: Select all
oWB.document.getElementById("movie_player").click()
Sleep 100
oWB.document.getElementById("movie_player").click()
==================================================
This is a version of the script above for YouTube, but which closes the notification bar via Acc.
Code: Select all
#IfWinActive, ahk_class IEFrame
;[WBGet function]
;Basic Webpage Controls with JavaScript / COM - Tutorial - Tutorials - AutoHotkey Community
;https://autohotkey.com/board/topic/47052-basic-webpage-controls-with-javascript-com-tutorial/
;Acc library (MSAA) and AccViewer download links - AutoHotkey Community
;https://autohotkey.com/boards/viewtopic.php?f=6&t=26201
~f::
WinGet, hWnd, ID, A
oWB := WBGet("ahk_id " hWnd)
if InStr(oWB.document.url, "youtube.com/")
|| InStr(oWB.document.url, "youtu.be/")
{
oWB.document.getElementsByClassName("ytp-fullscreen-button ytp-button").item[0].focus()
;oWB.document.getElementsByClassName("ytp-fullscreen-button ytp-button").item[0].click() ;didn't work
ControlSend, Internet Explorer_Server1, {Enter}, % "ahk_id " hWnd
}
oWB := ""
;close notification bar
ControlGet, hCtl, Hwnd,, DirectUIHWND1, % "ahk_id " hWnd
oAcc := Acc_Get("Object", "4.4", 0, "ahk_id " hCtl)
if (oAcc.accName(0) = "Close")
oAcc.accDoDefaultAction(0)
oAcc := ""
return
#IfWinActive
Last edited by jeeswg on 11 Aug 2017, 14:44, edited 2 times in total.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
Re: script to full screen YouTube videos
Nice jeeswg!
Just 2 tips:
Just 2 tips:
- You can use oWB.hwnd instead of WinGet, hWnd, ID, ahk_class IEFrame
- You can use oAcc := oAcc.accChild(4) instead of oAcc := Acc_Get("Object", "4.4", 0, "ahk_id " hCtl)
Re: script to full screen YouTube videos
Wasn't it F11 for all other IEs ??
Re: script to full screen YouTube videos
@tmplinshi: Thanks. It seems I left some extra lines in, from debugging, it's fixed now.
@BoBo: F11 sets fullscreen for Internet Explorer, f or double-click sets fullscreen for the YouTube video.
@BoBo: F11 sets fullscreen for Internet Explorer, f or double-click sets fullscreen for the YouTube video.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
- Masonjar13
- Posts: 1555
- Joined: 20 Jul 2014, 10:16
- Location: Не Россия
- Contact:
Re: script to full screen YouTube videos
This may or may not work..
More likely to work.
Anyone know a way to directly execute JS via COM?
Code: Select all
oWB.document.dblclk.createEventObject()
oWB.document.dblclk.eventType:="dblclick"
oWB.document.eventName="dblclick"
; call it
; oWB.document.getElementsByClassName("ytp-fullscreen-button ytp-button").item[0].fireEvent("on" . oWB.document.dblclk.eventType, oWB.document.dblclk)
oWB.document.getElementById("movie_player").fireEvent("on" . oWB.document.dblclk.eventType, oWB.document.dblclk)
Code: Select all
; oWB.navigate("javascript:var dblclk=document.createEventObject();dblclk.eventType='dblclick';document.getElementsByClassName('ytp-fullscreen-button ytp-button').item[0].fireEvent('on'+dblclk.eventType,dblclk);")
oWB.navigate("javascript:var dblclk=document.createEventObject();dblclk.eventType='dblclick';document.getElementById('movie_player').fireEvent('on'+dblclk.eventType,dblclk);")
Who is online
Users browsing this forum: Chunjee and 143 guests