AutoHotkey Chrome Part 3- How To Control Chrome With Invisible DevTool Window and Custom Menus

Published: 15 January 2021
on channel: TAB Nation - Automation
2,881
61

Lets Take a look at another way to use AHK with chrome by making our own custom context menus and sending JavaScript to the devtool window

Check out how to control chrome with ahk using an extension =    • AutoHotkey to Automate Chrome at Work...  

And another way =    • How to Master AutoHotkey Chrome Part ...  

CODE:
settitlematchmode, Regex

`::
if WinActive("ahk_class Chrome")
{
Menu, Submenu1, Add, Item1, MenuHandler
Menu, Submenu1, Add, Item2, MenuHandler

Menu, MyMenu, Add, 1 New Window, item1
Menu, MyMenu, Add, 2 New Tab, item2
Menu, MyMenu, Add, 3 Home Page, item3
Menu, MyMenu, Add, 4 previous page, item4
Menu, MyMenu, Add, 5 Close Chrome, item5
Menu, MyMenu, Add, Q Downloads, item6
Menu, MyMenu, Add, E Developer Tools, item7
Menu, MyMenu, Add, R Full Screen, item8
Menu, MyMenu, Add, More stuff, :Submenu1
Menu, MyMenu, Show
}
Return

MenuHandler:
msgbox, hi
Return

item1:
#IfWinActive ("ahk_exe chrome.exe")
send ^n
#IfWinActive
Return

item2:
#IfWinActive ("ahk_exe chrome.exe")
send ^t
#IfWinActive
Return

item3:
#IfWinActive ("ahk_exe chrome.exe")
send !{home}
#IfWinActive
Return

item4:
#IfWinActive ("ahk_exe chrome.exe")
send ^+t
#IfWinActive
Return

item5:
#IfWinActive ("ahk_exe chrome.exe")
send !f
send x
#IfWinActive
Return

item6:
#IfWinActive ("ahk_exe chrome.exe")
send ^j
#IfWinActive
Return

item7:
#IfWinActive ("ahk_exe chrome.exe")
send {f12}
#IfWinActive
Return

item8:
#IfWinActive ("ahk_exe chrome.exe")
send {f11}
#IfWinActive
Return

f2::
settitlematchmode 2
winactivate, Google Chrome ;focus on chrome for console setup
Sleep 250
send {f12} ;Opens console
Sleep 3000
Send ^p ;focus on commond search
Sleep 250
send undock ;find undock command
Sleep 250
send {Enter} ;confirms undock command
;winset, transparent, 0, DevTools
winactivate, DevTools
send ^`
return

f3::
winactivate, Facebook ;focus on console so chrome console loads correct frames
send {f12}
clipboard=setTimeout(function() {document.getElementById("email").focus();}, 1000);
send ^v
Send {enter}
winactivate, Facebook
sleep 2000
send [email protected]


Watch video AutoHotkey Chrome Part 3- How To Control Chrome With Invisible DevTool Window and Custom Menus online, duration hours minute second in high quality that is uploaded to the channel TAB Nation - Automation 15 January 2021. Share the link to the video on social media so that your subscribers and friends will also watch this video. This video clip has been viewed 2,881 times and liked it 61 visitors.