sasdad Posted June 18, 2007 Share Posted June 18, 2007 (edited) Hi, I'm trying to user browser events features, but with half success. The code below works (source from help) on one of my computers, but on second I'm getting error 80004002. Does anyone know how to solve it? I have looked for help on some other pages, but nothing seems to work. Maybe some libraries are wrongly registered. I need some ideas. Thank you expandcollapse popup; Example script, showing the usage of COM Event functions. ; Requires at least AutoIt beta version 3.1.1.104 ! ; ; See also: http://msdn.microsoft.com/workshop/browser/webbrowser/reference/objects/internetexplorer.asp ; We use a very simple GUI to show the results of our Events. #include "GUIConstants.au3" $GUIMain=GUICreate ( "Event Test", 600,500 ) $GUIEdit=GUICtrlCreateEdit ( "Test Log:" & @CRLF, 10, 20, 580, 400) $GUIProg=GUICtrlCreateProgress ( 10, 5, 580, 10) $GUIExit=GUICtrlCreateButton ( " Close ", 250, 450, 80, 30) GUISetState () ;Show GUI ; We prepare the Internet Explorer as our test subject $oIE=ObjCreate("InternetExplorer.Application.1") With $oIE .Visible=1 .Top = (@DesktopHeight-400)/2 .Height=400 ; Make it a bit smaller than our GUI. .Width=600 .Silent=1 ; Don't show IE's dialog boxes $IEWnd=HWnd(.hWnd); Remember the Window, in case user decides to close it EndWith ; We choose for a specific Internet Explorer interface 'DWebBrowserEvents' because the IE is subject ; to modifications by e.g. Visual Studio and Adobe Acrobat Reader. If you have IE-plugins installed, ; AutoIt might not be able to find the correct interface automatically. $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 ; Now starting to load an example Web page. $URL = "http://www.AutoItScript.com/" $oIE.Navigate( $URL ) sleep(1000) ; Give it some time to load the web page GUISwitch ( $GUIMain ); Switch back to our GUI in case IE stealed the focus ; Waiting for user to close the GUI. While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE or $msg = $GUIExit Then ExitLoop Wend $EventObject.Stop ; Tell IE we don't want to receive events. $EventObject=0 ; Kill the Event Object If WinExists($IEWnd) then $oIE.Quit; Close IE Window $oIE=0 ; Remove IE from memory (not really necessary). GUIDelete () ; Remove GUI exit ; End of our Demo. ; A few Internet Explorer Event Functions ; See also: http://msdn.microsoft.com/workshop/browser/webbrowser/reference/objects/webbrowser.asp Func IEEvent_BeforeNavigate($URL, $Flags, $TargetFrameName, $PostData, $Headers, $Cancel) ; Note: the declaration is different from the one on MSDN. 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" ) 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) ; Note: the declaration is different from the one on MSDN. GUICtrlSetData ( $GUIEdit, "IE has finished loading URL: " & $URL & @CRLF , "append" ) EndFunc Func IEEvent_($EventName) ; This is an optional event function to catch non-defined events. ; The parameter contains the name of the event being called. GUICtrlSetData ( $GUIEdit, "Uncatched event: " & $EventName & @CRLF , "append" ) EndFunc Edited June 18, 2007 by sasdad Link to comment Share on other sites More sharing options...
DaleHohm Posted June 18, 2007 Share Posted June 18, 2007 WINERROR.h shows this as: -2147467262 (80004002) No such interface supported So you may be be right about something not being installed properly. I've seen this reported once before, but never with a resolution. Dale Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble Link to comment Share on other sites More sharing options...
sasdad Posted June 18, 2007 Author Share Posted June 18, 2007 WINERROR.h shows this as: -2147467262 (80004002) No such interface supported So you may be be right about something not being installed properly. I've seen this reported once before, but never with a resolution. Dale But who knows It's so general error. It can be anything. Link to comment Share on other sites More sharing options...
Richard Robertson Posted June 18, 2007 Share Posted June 18, 2007 Do you really want Windows errors to be specific? Error low RAM: 2344344 bytes available. XD Link to comment Share on other sites More sharing options...
sasdad Posted June 19, 2007 Author Share Posted June 19, 2007 Do you really want Windows errors to be specific?Error low RAM: 2344344 bytes available. XD? Link to comment Share on other sites More sharing options...
Richard Robertson Posted June 19, 2007 Share Posted June 19, 2007 I'm just pointing out why some errors are so vague. Link to comment Share on other sites More sharing options...
Dale2507 Posted June 20, 2007 Share Posted June 20, 2007 If you wanted to log web pages, which function would you put the filewrite in? Deal or No Deal? Link to comment Share on other sites More sharing options...
sasdad Posted June 20, 2007 Author Share Posted June 20, 2007 If you wanted to log web pages, which function would you put the filewrite in?? Link to comment Share on other sites More sharing options...
sasdad Posted June 26, 2007 Author Share Posted June 26, 2007 Eureka! I made it. Everything that needs to be done is register dll file shdocvw.dll In command line run this command:regsvr32.exe shdocvw.dll Link to comment Share on other sites More sharing options...
thompsonson Posted July 19, 2007 Share Posted July 19, 2007 Hi, I'm trying to user browser events features, but with half success. The code below works (source from help) on one of my computers, but on second I'm getting error 80004002. Does anyone know how to solve it? I have looked for help on some other pages, but nothing seems to work. Maybe some libraries are wrongly registered. I need some ideas. Thank you expandcollapse popup; Example script, showing the usage of COM Event functions. ; Requires at least AutoIt beta version 3.1.1.104 ! ; ; See also: http://msdn.microsoft.com/workshop/browser/webbrowser/reference/objects/internetexplorer.asp ; We use a very simple GUI to show the results of our Events. #include "GUIConstants.au3" $GUIMain=GUICreate ( "Event Test", 600,500 ) $GUIEdit=GUICtrlCreateEdit ( "Test Log:" & @CRLF, 10, 20, 580, 400) $GUIProg=GUICtrlCreateProgress ( 10, 5, 580, 10) $GUIExit=GUICtrlCreateButton ( " Close ", 250, 450, 80, 30) GUISetState () ;Show GUI ; We prepare the Internet Explorer as our test subject $oIE=ObjCreate("InternetExplorer.Application.1") With $oIE .Visible=1 .Top = (@DesktopHeight-400)/2 .Height=400; Make it a bit smaller than our GUI. .Width=600 .Silent=1 ; Don't show IE's dialog boxes $IEWnd=HWnd(.hWnd); Remember the Window, in case user decides to close it EndWith ; We choose for a specific Internet Explorer interface 'DWebBrowserEvents' because the IE is subject ; to modifications by e.g. Visual Studio and Adobe Acrobat Reader. If you have IE-plugins installed, ; AutoIt might not be able to find the correct interface automatically. $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 ; Now starting to load an example Web page. $URL = "http://www.AutoItScript.com/" $oIE.Navigate( $URL ) sleep(1000) ; Give it some time to load the web page GUISwitch ( $GUIMain ); Switch back to our GUI in case IE stealed the focus ; Waiting for user to close the GUI. While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE or $msg = $GUIExit Then ExitLoop Wend $EventObject.Stop; Tell IE we don't want to receive events. $EventObject=0; Kill the Event Object If WinExists($IEWnd) then $oIE.Quit; Close IE Window $oIE=0 ; Remove IE from memory (not really necessary). GUIDelete () ; Remove GUI exit ; End of our Demo. ; A few Internet Explorer Event Functions ; See also: http://msdn.microsoft.com/workshop/browser/webbrowser/reference/objects/webbrowser.asp Func IEEvent_BeforeNavigate($URL, $Flags, $TargetFrameName, $PostData, $Headers, $Cancel) ; Note: the declaration is different from the one on MSDN. 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" ) 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) ; Note: the declaration is different from the one on MSDN. GUICtrlSetData ( $GUIEdit, "IE has finished loading URL: " & $URL & @CRLF , "append" ) EndFunc Func IEEvent_($EventName) ; This is an optional event function to catch non-defined events. ; The parameter contains the name of the event being called. GUICtrlSetData ( $GUIEdit, "Uncatched event: " & $EventName & @CRLF , "append" ) EndFunc That's really cool! I had a look at MSDN and it looks like there are other event interfaces (not sure if thats the term) but all this MFC and ATL is over my head! I just want to script... ok i'd like to copy and paste but scripting is cool to! ;-) So... do you (or anyone reading) know of a way to get more information about what the user is doing on the webpage. For instance, which elements the mouse has moved to and clicked on or if the layout of the page has changed (like the mouse has hovered over a menu and more information is displayed). Cheers, Matt Link to comment Share on other sites More sharing options...
DaleHohm Posted July 19, 2007 Share Posted July 19, 2007 You'll find some examples in the forum is you search for ObjEvent (although you'll need to gloss over the majority of the references there for setting up error handlers). Then to the Obj/COM section of the helpfile and then back to MSDN... Dale Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble Link to comment Share on other sites More sharing options...
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