HeinMueck Posted June 2, 2009 Share Posted June 2, 2009 Hi! Im trying to write a simple frontend for some webpages using the _IE* UDF's. In general - trivial But: Users have from IE6 up to IE8 on XP and Vista, maybe Win2k. So I was doing some tests with a simple scenario that contains all the stuff I would need and run it on different systems. The code below puts up some issues, which I would like to discuss and maybe get rid off. IE7 on XP: I have two machines, one fresh installed and one as my development machine. Both are fine, no issues with that code, all works as expected. IE6 on XP: Google opens, but when I try to submit the form and perform a search, just nothing happens. I also tried to work with _IEFormSubmit, but what did it on my machine and on IE8 lead to "Access is denied" errors on IE6. I turned off all security switches - nothing changed. I will dig on that, but if someone has a hint about making submit work (ah, also happens when IE is opened with _IECreate()) I would be pretty happy IE8 on XP: My biggest concern. Line 19 puts up a COM Error. IETest.au3 (19) : ==> Error in expression.: dim $SinkObject = ObjEvent($oIE, "IEEvent_", "DWebBrowserEvents2") dim $SinkObject = ^ ERROR Without the line, the script runs fine. But I do not get the events though. Hmm. It would be great if some of the forum members could run the script and give some feedback if you find more issues or if you found a solution for one of the problems. Thanks! Hein expandcollapse popup#cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.0.0 Author: myName Script Function: Template AutoIt script. #ce ---------------------------------------------------------------------------- #include <IE.au3> #include <GUIConstants.au3> ; Script Start - Add your code below here Dim $oIEErrorHandler = _IEErrorHandlerRegister("MyErrFunc") Dim $gui = GUICreate("Test", 920, 650, -1, -1) Dim $oIE = _IECreateEmbedded() dim $SinkObject = ObjEvent($oIE, "IEEvent_", "DWebBrowserEvents2") dim $IEview = GUICtrlCreateObj($oIE, 0, 0, 920, 650) _IENavigate($oIE, "http://www.google.com", 0) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd GUIDelete() Func IEEvent_DocumentComplete ($document, $url) ConsoleWrite("Done: " & $url & @crlf) EndFunc Func MyErrFunc() ; Important: the error object variable MUST be named $oIEErrorHandler $ErrorScriptline = $oIEErrorHandler.scriptline $ErrorNumber = $oIEErrorHandler.number $ErrorNumberHex = Hex($oIEErrorHandler.number, 8) $ErrorDescription = StringStripWS($oIEErrorHandler.description, 2) $ErrorWinDescription = StringStripWS($oIEErrorHandler.WinDescription, 2) $ErrorSource = $oIEErrorHandler.Source $ErrorHelpFile = $oIEErrorHandler.HelpFile $ErrorHelpContext = $oIEErrorHandler.HelpContext $ErrorLastDllError = $oIEErrorHandler.LastDllError $ErrorOutput = "" $ErrorOutput &= "--> COM Error Encountered in " & @ScriptName & @CR $ErrorOutput &= "----> $ErrorScriptline = " & $ErrorScriptline & @CR $ErrorOutput &= "----> $ErrorNumberHex = " & $ErrorNumberHex & @CR $ErrorOutput &= "----> $ErrorNumber = " & $ErrorNumber & @CR $ErrorOutput &= "----> $ErrorWinDescription = " & $ErrorWinDescription & @CR $ErrorOutput &= "----> $ErrorDescription = " & $ErrorDescription & @CR $ErrorOutput &= "----> $ErrorSource = " & $ErrorSource & @CR $ErrorOutput &= "----> $ErrorHelpFile = " & $ErrorHelpFile & @CR $ErrorOutput &= "----> $ErrorHelpContext = " & $ErrorHelpContext & @CR $ErrorOutput &= "----> $ErrorLastDllError = " & $ErrorLastDllError ConsoleWrite($ErrorOutput) SetError(1) Return EndFunc ;==>MyErrFunc Link to comment Share on other sites More sharing options...
DaleHohm Posted June 3, 2009 Share Posted June 3, 2009 IE8, XP your script runs fine for me. I no longer have IE6 anywhere. 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...
HeinMueck Posted June 4, 2009 Author Share Posted June 4, 2009 (edited) Thanks Dale, I solved all issues that I mentioned - here is what I did:IE6: The issue was that IE was asking if it is okay to send the form data (usually happens after ie installation once and then you kick it), but the dialog did not show up because of silent mode. I changed the code to show the dialog box to the user.Dim $oIE = _IECreateEmbedded() dim $IEview = GUICtrlCreateObj($oIE, 0, 0, 920, 650) $oIE.Silent = FalseoÝ÷ ØùZqéجjh®Ö§¶+]¡ë'¢Ü(®HÊ©ºØ®(!µ§íz»azãyËlr·¶*'wr¢éÞyÛh±ëb¶Új[t¢½h©ò¶§'¶)à²)^Ûh}©ly©l¢¥¦Ëh±çêk£ç^ØÇbjZ ü¨º¯zÚºØ^Øjסªk£¶«Â+Ê°¢é]`zØjwmì"Ú0²ËZÊÆåjyMg(ºWm+z·²ß¢»azÊ&zئzË©®+" ®¢Ðqë,Ç^'ªê-zºè®Ì!z{.nh¶)à~æ±.q©äwhiçâÇm+ÊǶ)දj[{az· ËkÉ©Ý©²êÞ~æu«Zq©ÚrÛzǧu«¢+ÙI]É¥Ñ ÅÕ½Ðí!-e} UII9Q}UMHÀäÈíM½ÑÝÉÀäÈí5¥É½Í½ÐÀäÈí]¥¹½ÝÌÀäÈí ÕÉɹÑYÉÍ¥½¸ÀäÈí%¹ÑɹÐMÑÑ¥¹ÌÀäÈíi½¹ÌÀäÈìÌÅÕ½Ðì°ÅÕ½ÐìÄØÀÄÅÕ½Ðì°ÅÕ½ÐíI}]=IÅÕ½Ðì°ÀFind a list of other values Microsoft TechnetIE8: It was an easy one. The registration of the control was corrupted. Just run regsvr32 to 'fix' it.regsvr32 C:\WINDOWS\system32\shdocvw.dllHope that helps someone sometime Cheers,Hein Edited June 4, 2009 by HeinMueck Link to comment Share on other sites More sharing options...
DaleHohm Posted June 4, 2009 Share Posted June 4, 2009 That could all be good reference. Thanks for posting back. Regarding placement of the .silent... the WebBrowser control is not accessible until it is embedded in a container - you can perform no actions with it until it is. Regarding the Access Is Denied on _IEFormSubmit... truth be told, there is the one major thing I would change about IE.au3 and that was including the _IELoadWait in _IEFormSubmit. I have not changed it for fear of breaking existing scripts. I recommend setting the wait parameter to 0 and following the call with _IELoadWait($oIE). I expect that will clear your problems. 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...
HeinMueck Posted June 5, 2009 Author Share Posted June 5, 2009 In my case, I did put the code as you advise from the beginning, but the "Access is denied" error here was clearly related to the setting of the 1601 regkey. I fiddled with the key, but it seems that in some environments you cannot supress the dialog when it is actualy the first time you submit a form. Even setting the regkey in advance does not save you from it (in my case IE6 on win 2003 terminal server). I could not trigger the same problem on a winxp workstation with IE7. There, writing 0 to the key at the start of the script was clearly enough. But I may be wrong anyway I used a fresh installed XP on a vmware with various snapshots and all worked out of the box, 6,7 and 8. Fresh accounts on the terminal server seem to be different, may be the same with domain accounts. After I could see the dialog and confirmed it once, everything was fine. Even the once problematic code using _IEFormSubmit worked without a change, no more access issues. Hein 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