Jump to content
junkew

IE.AU3 error on _IEPropertyGet($oIE, "hwnd")

Recommended Posts

junkew

I was playing a little with IE UDF but get some "weird" behavior.

  • Is this correct / logical that I cannot get hwnd (messagbox says 3 browsers found but fails when I try to get hwnd for them all
; Create an array of object references to all current browser instances
; The first array element will contain the number of instances found

#include <IE.au3>
#include <MsgBoxConstants.au3>

Local $aIE[1]
$aIE[0] = 0

Local $i = 1, $oIE
While 1
    $oIE = _IEAttach("", "instance", $i)
    If @error = $_IEStatus_NoMatch Then ExitLoop
    ReDim $aIE[$i + 1]
    $aIE[$i] = $oIE
    $aIE[0] = $i
    consolewrite($oie.locationurl & @CRLF)
;~ uncomment below
;~  consolewrite( _IEPropertyGet($oIE, "hwnd")  & @CRLF)

    $i += 1
WEnd

MsgBox($MB_SYSTEMMODAL, "Browsers Found", "Number of browser instances in the array: " & $aIE[0])

gives as output in 3.3.14.2 version of autoit and msgbox gives back 3 browsers (where I only see one so I assume 1 is the new tab)

https://<url removed but its an url from open browser>
about:blank
about:blank
--> IE.au3 T3.0-2 Warning from function _IEAttach, $_IESTATUS_NoMatch
>Exit code: 0    Time: 7.003

Basically I want to know

  • How many IE browsers (or tabs) are open for user interaction
    • Visible
    • Settable addressbar
    • ....
  • Which one is the last one opened (so not the last one in z-order of windows)

Share this post


Link to post
Share on other sites
Subz

This works fine for me, instance should show you which order the pages were opened:

#include <Array.au3>
#include <IE.au3>

Local $aIE[1][5]
;~ For testing purposes
    Local $oIE = _IECreate("https://www.msn.com/en-nz/", 1)
        $oIE.Navigate2("https://www.autoitscript.com", 0x0800)
        $oIE.Navigate2("https://www.uexpress.com/news-of-the-weird", 0x0800)
    _IECreate("https://nz.yahoo.com/?p=us", 1)
    _IECreate("https://www.msn.com/en-nz/", 1)

Local $i = 1
While 1
    $oIE = _IEAttach("", "instance", $i)
        If @error = $_IEStatus_NoMatch Then ExitLoop
    _ArrayAdd($aIE, $i & "|" & $oIE.locationurl & "|" & _IEPropertyGet($oIE, "hwnd") & "|" & _IEPropertyGet($oIE, "visible") & "|" & _IEPropertyGet($oIE, "addressbar"))
    $i += 1
WEnd
$aIE[0][0] = UBound($aIE) - 1
_ArrayDisplay($aIE, "IE Instance Info", "", 0, Default, "Instance|Address|Handle|Visible|Addressbar Visible")

 

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

×