0
votes

I am attempting to select a 'copy-to-clipboard' function within a website that is buried pretty deep within the DOM. As proof of concept, I'd like to have AutoHotKey .click() the anchor element, and then display it's contents in a MsgBox. From the javascript console in IE I can manipulate it just fine using the below code:

t = document.getElementById("id-value")
t.getElementsByTagName("td")[1].click()

These two lines do what I want it to do... when I place them within an AHK script, it just kind of hangs out... below you'll find my AHK script

#SingleInstance, Force
#Include, C:\Users\rspeight\Desktop\AHK_Scripts\IEFuncs.ahk    

IE("https://validURL", true)
sleep, 3000

t:= document.getElementByID("2752")
t.getElementByTagName("td")[1].click()

MsgBox, Did this work?

Return

any help would be greatly appreciated.

1
What does "it just kind of hangs out" mean? It doesn't make it to the msgbox? Can you do some debugging to see exactly which line it is "hanging" on? Also in your first code you have getElementsByTagName, in the AHK example you have getElementByTagName (no s).S. User18
Thanks for the response... I was somewhat vague, but I was able to get it working. I had to work on it a bit more.Rsp8

1 Answers

0
votes

Below is what I did to make it work.

pwb := WBGet()

t:=pwb.document.getElementById("2752")
d:=t.getElementsByTagName("td")[1].click()
sleep, 2000
b:=pwb.document.getElementById("secretView_2752")
r:=b.getElementsByTagName("a")[3].click()

for some reason, I had to place the 'tagname' element into another variable.