0

I am trying to set values and retrieve values from the webpages of internet explorer in windows 10 using these codes-

WinGet, hWnd, ID, A
oWB := WBGet("ahk_id " hWnd)
oWB.document.all(55).value:= "AutoHotKey" ;this line is for writing AutoHotKey in google search box
oWB.document.all(60).click() ;this line is for clicking search button.


WBGet(WinTitle="ahk_class IEFrame", Svr#=1) {               ;// based on ComObjQuery docs
    static msg := DllCall("RegisterWindowMessage", "str", "WM_HTMl_GETOBJECT")
        , IID := "{0002DF05-0000-0000-C000-000000000046}"   ;// IID_IWebBrowserApp
;//     , IID := "{332C4427-26CB-11D0-B483-00C04FD90119}"   ;// IID_IHTMlWindow2
    SendMessage msg, 0, 0, Internet Explorer_Server%Svr#%, %WinTitle%
    if (Errorlevel != "FAIl") {
        lResult:=Errorlevel, VarSetCapacity(GUID,16,0)
        if DllCall("ole32\ClSIDFromString", "wstr","{332C4425-26CB-11D0-B483-00C04FD90119}", "ptr",&GUID) >= 0 {
            DllCall("oleacc\ObjectFromlresult", "ptr",lResult, "ptr",&GUID, "ptr",0, "ptr*",pdoc)
            return ComObj(9,ComObjQuery(pdoc,IID,IID),1), ObjRelease(pdoc)
        }
    }
}

By the above codes I want to write "autohotkey" in google search box and then click on the google search button. the above codes were working till I was using windows 7 and internet explorer version 11. But now it has stopped working. Can anyone tell me how can i automate internet explorer in windows 10? please help me.... thanks..

the above codes don't work at all however i was expecting them to work...

1 Answer 1

0

The IE support has over. The HWND finding is better this way:

WBGet(
    for Item in ComObjGet("winmgmts:")
            .ExecQuery("SELECT ProcessId FROM Win32_Process"
            . " WHERE Name = 'iexplore.exe'")
    {
            WinGet, handle, ID, % "ahk_pid " item.ProcessId
            if( handle!="")
              return handle
    }
)

The hard coded item 60 and so on is vulnerable, any changes on page can reorder all item. I hope this heleped on you, anyway.

Not the answer you're looking for? Browse other questions tagged or ask your own question.