NSearch Posted April 20, 2005 Posted April 20, 2005 Hello all. Is there a function to wait for a page to load in internet explorer. I would like the page to load in, then move the mouse to a specific part of the page, and then send() data. Thanks.
NSearch Posted April 20, 2005 Author Posted April 20, 2005 I tried: WinWaitActive ("Welcome to Blah - Microsoft Internet Explorer","") But that didnt work
NSearch Posted April 20, 2005 Author Posted April 20, 2005 I figured it out. I had the winactivewait command in the wrong spot.....
LOULOU Posted April 20, 2005 Posted April 20, 2005 Here the code which allow you to control IE (credit SvenP) expandcollapse popup; AutoItCOM 3.1.0 ; ; Test file ; ; Test usage of Events with Internet Explorer ; ; Create a simple GUI for our output #include "GUIConstants.au3" GUICreate ( "Event Test", 640, 480 ) $GUIEdit=GUICtrlCreateEdit ( "Test Log:" & @CRLF, 10, 10 , 600 , 400 ) GUISetState () ;Show GUI $oMyError=ObjEvent("AutoIt.Error","MyErrFunc") $oIE=ObjCreate("InternetExplorer.Application.1") if @error then Msgbox(0,"","Error opening Internet Explorer: " & @error) exit endif $oIE.Visible=1 $oIE.RegisterAsDropTarget = 1 $oIE.RegisterAsBrowser = 1 ; The Event interfaces of the Internet Explorer are defined in: SHDOCVW.DLL ; ; HTMLElementEvents2 ; DWebBrowserEvents ; DWebBrowserEvents2 ; -> NOTE1: If you have installed VC6 (DevStudio8) this one is renamed to: DWebBrowserEvent2Sink ! ; -> NOTE2: If you have installed the Adobe Acrobat Reader 6.0 IE plugin then the type library of this ; interface is modified to "AcroIEHelper 1.0 Type Library" $SinkObject=ObjEvent($oIE,"IEEvent_","DWebBrowserEvents2") if @error then Msgbox(0,"","ObjEvent: Can't use interface 'DWebBrowserEvents2'. error code: " & hex(@error,8)) exit endif ProgressOn ( "Internet Explorer Event test", "Loading web page","",-1,-1, 16 ) $URL = "http://www.AutoItScript.com/" $oIE.Navigate( $URL ) sleep(3000) ; Give it the time to load the web page $SinkObject=0 ; Stop IE Events $oIE.Quit ; Quit IE $oIE=0 ProgressOff() GUICtrlSetData ( $GUIEdit, @CRLF & "End of Internet Explorer Events test." & @CRLF , "append" ) GUICtrlSetData ( $GUIEdit, "You may close this window now !" & @CRLF , "append" ) ; Waiting for user to close the window While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop Wend GUIDelete () exit ; a few Internet Explorer Event Functions ; --------------------------------------- Func IEEvent_ProgressChange($Progress,$ProgressMax) ProgressSet ( ($Progress * 100) / $ProgressMax , ($Progress * 100) / $ProgressMax & " percent to go." , "loading web page" ) EndFunc Func IEEvent_StatusTextChange($Text) GUICtrlSetData ( $GUIEdit, "IE Status text changed to: " & $Text & @CRLF , "append" ) EndFunc Func IEEvent_PropertyChange( $szProperty) GUICtrlSetData ( $GUIEdit, "IE Changed the value of the property: " & $szProperty & @CRLF , "append" ) EndFunc Func IEEvent_DownloadBegin() GUICtrlSetData ( $GUIEdit, "IE has started a navigation operation" & @CRLF , "append" ) EndFunc Func IEEvent_DownloadComplete() GUICtrlSetData ( $GUIEdit, "IE has finished a navigation operation" & @CRLF , "append" ) EndFunc Func IEEvent_NavigateComplete2($oWebBrowser,$URL) ; IDispatch *pDisp, ; VARIANT *URL GUICtrlSetData ( $GUIEdit, "IE has finished loading URL: " & $URL & @CRLF , "append" ) EndFunc ; AutoIt Error Event Function ; --------------------------- Func MyErrFunc() $HexNumber=hex($oMyError.number,8) Msgbox(0,"","We intercepted a COM Error !" & @CRLF & @CRLF & _ "err.description is: " & @TAB & $oMyError.description & @CRLF & _ "err.windescription:" & @TAB & $oMyError.windescription & @CRLF & _ "err.number is: " & @TAB & $HexNumber & @CRLF & _ "err.lastdllerror is: " & @TAB & $oMyError.lastdllerror & @CRLF & _ "err.scriptline is: " & @TAB & $oMyError.scriptline & @CRLF & _ "err.source is: " & @TAB & $oMyError.source & @CRLF & _ "err.helpfile is: " & @TAB & $oMyError.helpfile & @CRLF & _ "err.helpcontext is: " & @TAB & $oMyError.helpcontext _ ) SetError(1) ; to check for after this function returns Endfunc
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now