Sign in to follow this  
Followers 0
HeinMueck

IE.au3 and Browserversions

5 posts in this topic

Hi!

Im trying to write a simple frontend for some webpages using the _IE* UDF's. In general - trivial :D 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

#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

Share this post


Link to post
Share on other sites



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

Share this post


Link to post
Share on other sites

#3 ·  Posted (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 Technet

IE8: It was an easy one. The registration of the control was corrupted. Just run regsvr32 to 'fix' it.

regsvr32 C:\WINDOWS\system32\shdocvw.dll

Hope that helps someone sometime :D

Cheers,

Hein

Edited by HeinMueck

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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 :D 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

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0