Chrome.ahk

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
sdetwil
Posts: 1
Joined: 28 Sep 2022, 13:04

Chrome.ahk

Post by sdetwil » 28 Sep 2022, 13:20

Read up on a couple of tutorials on Chrome.ahk and trying to put together a script but it's also my first time working with JavaScript too and having issues. Have the script below put together but I'm getting an error on the PageInstance.Evaluate line: "Uncaught TypeError: Cannot set properties of null (setting 'value') TypeError: Cannot set properties of null (setting 'value')". If I try to use just the JavaScript in the Chrome console I get the same error but I found out that if I change the console target(?) to the picture below, the code works in the browser console. So question is, how do I get Chrome.ahk to point to the same thing?

image.png
image.png (11.08 KiB) Viewed 315 times

Code: Select all

#Include C:\Users\%A_UserName%\Desktop\Help Desk\Other AHK Scripts\Chrome.ahk
FileCreateDir, C:\Users\%A_UserName%\AppData\Local\Google\Chrome\User Data\AHKProfile
target := "C:\Users\" A_UserName "\AppData\Local\Google\Chrome\User Data\AHKProfile"
ChromeInst := new Chrome(target)
PageInstance := ChromeInst.GetPage()
PageInstance.Call("Page.navigate", {"url": "https://daktronics.lightning.force.com/lightning/setup/PublicGroups/page?address=%2Fsetup%2Fown%2Fgroupedit.jsp%3Fid%3D00G6T000004BZks"})
PageInstance.WaitForLoad()
Sleep, 2000
PageInstance.Evaluate("document.getElementById('sharing_search').value = 'U';")

Return to “Ask for Help (v1)”