AutoHotKeys automate Chrome without Chrome.ahk

19.1.2023 - 537 просмотров ;)

We will use no one AutoHotKeys libs.

How to inject JavaScript code to DevTools ?
Open browser:

if WinExist(«ahk_exe msedge.exe»)
WinActivate

I mean DevTools and favorite URL is opened.. or simply press Ctrl-Shift-j? and put URL in adress bar.

Focus on devtool console

Send, ^« ; goto console

Clear console

Send, ^l ; clear console

Remove all text in console

Send, ^+{Home}{Del} ; remove all text in console

And now send commands to page

Send, document.querySelector(«{#}platform_domain»).value=»%A_LoopField%»;{Enter}

Cause we can send variables, and hashes  we need to escaping

Commands may be like that:

Send, document.querySelector(«{#}platform_domain»).value=»%A_LoopField%»;{Enter}
Sleep,100
Send, document.querySelector(«{#}flash_messages»).remove();{Enter}
Sleep,100
Send, document.querySelector(«{#}addsite_submit»).click();{Enter}
Sleep,100

Then we need some of feedback from JavaScript to AutoHotKeys.

we will do it through the clipboard

Clipboard = zzz

wait while clipboard get new data

Loop,
{
Sleep,3000
Send, ^« ; goto console
Send, copy(document.getElementById(«flash_messages»).innerText){Enter}
if (Clipboard != «zzz»){
break
}
}

Gotcha !

%Clipboard% — has our data!

 

This schame is work fine and dont need Chrome.ahk

Статьи из раздела, Видеочат рулетка