Sign in to follow this  
Followers 0
Hasher

loop to attaching to active IE windows bugs

2 posts in this topic

#1 ·  Posted (edited)

I have written a small app but this is its main function of attaching to a IE window that has focus. I used the attach via windows titles as this supports the tabs in IE7 where as the handle method doesn't pick up the tabs ;-) Main place it throws an errow is in the DWEvent_BeforeNavigate2() event where it "sometimes" doesnt seem to find the $oIE object and exits . Can anyone can suggest improvements in the logic and offer any advice regarding the error.

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

#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
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



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