haomm Posted March 24, 2011 Posted March 24, 2011 expandcollapse popup#include <GUIConstantsEx.au3> #include <IE.au3> Dim $Text,$EventName, $Text2 $GUIMain=GUICreate ( "Event Test", 1000,800 ) $GUIEdit=GUICtrlCreateEdit ( "Test Log:" & @CRLF, 10, 20, 980, 400) $GUIProg=GUICtrlCreateProgress ( 10, 5, 580, 10) GUISetState () $oIE = _IECreateEmbedded () GUICtrlCreateObj($oIE,0, 421, 980, 350) $EventObject=ObjEvent($oIE,"IEEvent_","DWebBrowserEvents") if @error then Msgbox(0,"AutoIt COM Test", _ "ObjEvent: Can't use event interface 'DWebBrowserEvents'. Error code: " & hex(@error,8)) exit endif $URL = "http://www.google.com/search?sclient=psy&hl=en&site=&source=hp&q=autoitscript&btnG=Google+Search" $oIE.Navigate( $URL ) sleep(1000) GUISwitch ( $GUIMain ) While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop Wend $EventObject.Stop $EventObject=0 $oIE=0 GUIDelete () Exit Func IEEvent_BeforeNavigate($URL, $Flags, $TargetFrameName, $PostData, $Headers, $Cancel) GUICtrlSetData ( $GUIEdit, "BeforeNavigate: " & $URL & " Flags: " & $Flags & " tgframe: " & $TargetFrameName & " Postdat: " & $PostData & " Hdrs: " & $Headers & " canc: " & $Cancel & @CRLF , "append" ) EndFunc Func IEEvent_ProgressChange($Progress,$ProgressMax) If $ProgressMax > 0 Then GUICtrlSetData($GUIProg, ($Progress * 100) / $ProgressMax ) EndIf EndFunc Func IEEvent_StatusTextChange($Text) GUICtrlSetData ( $GUIEdit, "IE Status text changed to: " & $Text & @CRLF , "append" ) If $Text<>'' Then $Text2=$Text If $EventName ='NewWindow' And $Text<>'' Then $oIE.Navigate( $Text2 ) EndIf EndFunc Func IEEvent_PropertyChange( $szProperty) GUICtrlSetData ( $GUIEdit, "IE Changed the value of the property: " & $szProperty & @CRLF , "append" ) EndFunc Func IEEvent_DownloadComplete() GUICtrlSetData ( $GUIEdit, "IE has finished a navigation operation" & @CRLF , "append" ) EndFunc Func IEEvent_NavigateComplete($URL) GUICtrlSetData ( $GUIEdit, "IE has finished loading URL: " & $URL & @CRLF , "append" ) EndFunc Func IEEvent_($EventName) GUICtrlSetData ( $GUIEdit, "Uncatched event: " & $EventName & @CRLF , "append" ) If $EventName ='NewWindow' Then;If the window pops up ie WinKill("[active]"); kill it $oIE.Navigate( $Text2 );Catch them pop-up window,Return to the GUI EndIf EndFunc Currently embedded IE "target = _blank" type of link will pop up just click Gui question has not been effectively resolvedHow to make even more perfect
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