Code: Select all
#singleinstance, force
setbatchlines -1
fileread, js, code.js
fileread, fjson, json.json
json := new json()
arr := json.load(fjson)
chromepath:="C:\Program Files\Google\Chrome\Application\chrome.exe"
profilepath := A_scriptdir "/chrom22"
FileCreateDir, chrom22
Chrome := new chrome(profilePath,"https://website.com/","--remote-debugging-port=9222 --enable-logging --v=1 --log-level=0",chromePath)
sleep 6000
page := chrome.getPage(,,Func("Callback").Bind())
page.Call("Log.Enable")
page.waitForLoad()
sleep 2000
msgbox % Page.evaluate(js)
ExitApp
Callback(event){
GLOBAL
;Listen for messages with your specific message and do an action
msgbox % st_printarr(event)
if (Event.Method = "Console.messageAdded") {
msgbox % Event.params.message.text
}
else if (Event.Method = "Inspector.Detached"){
ChromeInst.Kill()
exitapp
}
}
#include chrome.ahk
#include json.ahk
#include printarr.ahk