I've followed the tutorial on how to control websites using COM on this thread: https://autohotkey.com/board/topic/64563-basic-ahk-v11-com-tutorial-for-webpages/
When executing my .ahk file I get an error as soon the websites open and the script tries to click on the button to search on google.
Code: Select all
IELoad(wb) ;You need to send the IE handle to the function unless you define it as global.
{
If !wb ;If wb is not a valid pointer then quit
Return False
Loop ;Otherwise sleep for .1 seconds untill the page starts loading
Sleep,100
Until (wb.busy)
Loop ;Once it starts loading wait until completes
Sleep,100
Until (!wb.busy)
Loop ;optional check to wait for the page to completely load
Sleep,100
Until (wb.Document.Readystate = "Complete")
Return True
}
wb := ComObjCreate("InternetExplorer.Application") ;create an IE instance
wb.Visible := True
wb.Navigate("Google.com")
IELoad(wb)
wb.Document.All.q.Value := "site:autohotkey.com tutorial"
wb.Document.All.btnK.Click()
IELoad(wb)
AHK Version: 1.1.24.02 (can't update to newer version because of managed desktop client)
OS: Windows 10
I hope you guys can help me!