IE Load not working in Internet explorer 11. Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Newuser9888

IE Load not working in Internet explorer 11.

28 Dec 2016, 09:09

IE Load not working in Internet explorer 11.


getting following error

---------------------------
extra.ahk
---------------------------
Error: 0x80010108 - The object invoked has disconnected from its clients.


Specifically: busy

Line#
006: {
007: if !pwb
008: Return,False
009: Loop
010: Sleep,100
---> 011: Until,(pwb.busy)
012: Loop
013: Sleep,100
014: Until,(!pwb.busy)
015: Loop
016: Sleep,100
017: Until,(pwb.Document.Readystate = "Complete")
018: Return,True

Continue running the script?
---------------------------
Yes No
---------------------------



IELoad(pwb)
{
If !pwb ;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 (pwb.busy)
Loop ;Once it starts loading wait until completes
Sleep,100
Until (!pwb.busy)
Loop ;optional check to wait for the page to completely load
Sleep,100
Until (pwb.Document.Readystate = "Complete")
Return True
}
Guest

Re: IE Load not working in Internet explorer 11.

30 Aug 2017, 08:17

Vh_ wrote:while pwb.busy or pwb.ReadyState != 4
It's not working. Can you please add it in above script
learner_self

Re: IE Load not working in Internet explorer 11.

30 Aug 2017, 08:40

IELoad(pwb) working on other url but not working with following URL

https://brightree.net/frmLogin.aspx?

getting same error while trying to open above url. Can someone please help me to get IELoad(pwb) work with above URL
Vh_
Posts: 203
Joined: 17 Mar 2017, 22:06

Re: IE Load not working in Internet explorer 11.  Topic is solved

02 Sep 2017, 21:56

Try this.

Code: Select all

pwb := WBGet()


pwb.Navigate("https://brightree.net/frmLogin.aspx?") ;Navigate to URL

while pwb.busy or pwb.ReadyState != 4 ;Wait for page to load
	Sleep, 100

msgbox, the page has now loaded.

;************Pointer to Open IE Window******************
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)
		}
	}
}
User avatar
rommmcek
Posts: 1473
Joined: 15 Aug 2014, 15:18

Re: IE Load not working in Internet explorer 11.

03 Sep 2017, 01:01

Seems, it doesn't work anymore if IeFrame window not exists.
Try this workaround:

Code: Select all

run, iexplore
WinWait, ahk_class IEFrame
WinWaitActive, ahk_class IEFrame
sleep, 1000 ; increase sleep duration if needed

	WinGetTitle, WinTitle, ahk_class IEFrame
	wb:=pwb_Get(WinTitle, 1)
	if winTitle
		wb.Navigate("https://brightree.net/frmLogin.aspx?")
	while WinActive(WinTitle)
		sleep, 100
	While wb.readyState != 4 || wb.document.readyState != "complete" || wb.busy
		sleep, 100

MsgBox, Hope workaround works for you!
ExitApp


PWB_Get(WinTitle="A", Svr#=1) ; Jethrow - http://www.autohotkey.com/board/topic/47052-basic-webpage-controls-with-javascript-com-tutorial/
{
	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)
		}
	}
	MsgBox, 262160, %A_ScriptName% - %A_ThisFunc%(): Error,  Unable to obtain browser object (PWB) from window:`n`n%WinTitle%
}
Edit: Looks like I found better fully automated workaround:

Code: Select all

	wb := ComObjCreate("InternetExplorer.Application")
	wb.Visible := true
	wb.Navigate("", 0)
	While wb.readyState != 4 || wb.document.readyState != "complete" || wb.busy
		sleep, 100	
	wb.Navigate("https://brightree.net/frmLogin.aspx?")
	wb:=pwb_Get()
	While wb.readyState != 4 || wb.document.readyState != "complete" || wb.busy
		sleep, 100
		
	MsgBox, Webpage loaded
	ExitApp
	
	PWB_Get(WinTitle="A", Svr#=1) ; Jethrow - http://www.autohotkey.com/board/topic/47052-basic-webpage-controls-with-javascript-com-tutorial/
{
	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)
		}
	}
	MsgBox, 262160, %A_ScriptName% - %A_ThisFunc%(): Error,  Unable to obtain browser object (PWB) from window:`n`n%WinTitle%
}

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: haomingchen1998 and 245 guests