Sign in to follow this  
Followers 0
Hasher

IEAttach title vs hwnd

5 posts in this topic

OK I post a probelm yesterday and after a sleep and some deep thought I found my probelm ;-) Posted yesterday here http://www.autoitscript.com/forum/index.php?showtopic=41674

It revolves around the the _IEAttach method I use , if I use the "title" way _IEAttach($title, "Title") it supports the IE7 tabs BUT fails *sometimes* with DOM like:

C:\Documents and Settings\Administrator\Desktop\test.au3 (24) : ==> Variable must be of type "Object".:

MsgBox(4096,"test",$oIE.document.url)

MsgBox(4096,"test",$oIE^ ERROR

Whereas if I use the _IEAttach($hwnd, "hwnd") method then it attachs to IE7 but not its tabs.

Am I pushing the IEAttach's function to hard as IE.au3 doesnt support tabs yet or is there a work around that I can use. Only getting data from the page not writing to it.

THanks for any help in advance !!

Yesterdays code that produces errors (try logging into hotmail)

#include <IE.au3>
#include <Array.au3>
#include <file.au3>
AutoItSetOption ("WinTitleMatchMode",4)
    $tit = ""
    $title = ""
    While 1
    Do
    sleep(100)
    if WinGetHandle("classname=IEFrame", "") == WinGetHandle("Active", "")  Then
            $title = StringMid(WinGetTitle("Active",""),1,StringInStr(WinGetTitle("Active",""),"-"))
        EndIf
    Until $title <> ""
    if $tit <> $title Then
    $tit = $title
    $oIE = _IEAttach($title, "Title")
    $oIEEvents = ObjEvent ($oIE,"IEEvent_")
    $oDWEvents = ObjEvent ($oIE,"DWEvent_","DWebBrowserEvents2")
    endif
    WEnd    

Func DWEvent_BeforeNavigate2()
MsgBox(4096,"test",$oIE.document.url)
endfunc

Firefox's secret is the same as Jessica Simpson's: its effortless, glamorous style is the result of — shhh — extensions!

Share this post


Link to post
Share on other sites



You do realize that it is your code that is producing that error and NOT IE.au3 right?

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)

Please enlighten me Dale or give me a shove in the right direction :-D I am not saying its IE.au3 probelm , I was blameing IE7 tabs

Edited by Hasher

Firefox's secret is the same as Jessica Simpson's: its effortless, glamorous style is the result of — shhh — extensions!

Share this post


Link to post
Share on other sites

Please enlighten me Dale or give me a shove in the right direction :-D I am not saying its IE.au3 probelm , I was blameing IE7 tabs

The error you showed was on line 24 of your script: MsgBox(4096,"test",$oIE.document.url)

It is most likely that for some reason $oIE may not have a valid document (at least at the time th command is executed). Suggest you use isObj and ObjName funnctions to debug. and check $oIE and $oIE.documnt. You can also use _IEErrorHndlerRegister() so that the error can be trapped and you'll get more information in the console.

The hwnd will be the handle of the container window and when you attach to it you get the active browser window. You can use _IEAttach with title and several other attributes because it loops through the Shell.Windows collection which picks up all the browserrs in the tabs.

There are situations when a valid browser object does not have .document and even some cases when the .document does not have all of the expected properties, like .url and if you are in the middle of a Redirect all bets are off. It would help if you could dig deeper and perhaps provide a reproducer.

Hope this helps.

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

Thank you Dale , enlightening as normal :whistle:

BTW love the 'thinking' Gorilla !!!!


Firefox's secret is the same as Jessica Simpson's: its effortless, glamorous style is the result of — shhh — extensions!

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