Capel Posted September 29, 2010 Posted September 29, 2010 If I have multiple IE browser windows with similar titles, how do I determine which one is on top? I'm trying to iterate over all the open browser windows, but the code below shows 2 instances of each browser. They have different handles. This is strange... $lstViewers = WinList($sTitle) For $i = 1 to $lstViewers[0][0] ConsoleWrite("Title=" & $lstViewers[$i][0] & " Handle=" & $lstViewers[$i][1] & @CRLF) Next
JohnOne Posted September 29, 2010 Posted September 29, 2010 Heres a start for you, I have 3 IE windows open, this lists all, and only 3. #include <Array.au3> $title = "[Class:IEFrame]" $awin = WinList($title) _ArrayDisplay($awin) AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
jebus495 Posted September 29, 2010 Posted September 29, 2010 Found this poking around in the Help File under "Window Titles and Text (Advanced)" Advanced Window Descriptions A special description can be used as the window title parameter. This description can be used to identify a window by the following properties: TITLE - Window title CLASS - The internal window classname REGEXPTITLE - Window title using a regular expression (if the regular expression is wrong @error will be set to 2) REGEXPCLASS - Window classname using a regular expression (if the regular expression is wrong @error will be set to 2) LAST - Last window used in a previous AutoIt command ACTIVE - Currently active window X \ Y \ W \ H - The position and size of a window INSTANCE - The 1-based instance when all given properties match WinClose("[ACTIVE]", "") This should help you.
Capel Posted September 29, 2010 Author Posted September 29, 2010 How do I get the Z order property of an IE window? I need the one on top.
JohnOne Posted September 29, 2010 Posted September 29, 2010 Well I dont know what a z order is, but this gives me the active one, if indeed one is active.The sleep is just there, so I could activate one of them.#include <Array.au3> $title = "[Class:IEFrame]" $awin = WinList($title) Sleep(2000) For $i = 1 To $awin[0][0] $state = WinGetState($awin[$i][0]) If BitAND($state, 8) Then MsgBox(0,"",$awin[$i][0] & " Is active" & @LF & "Handle = " & $awin[$i][1]) EndIf Next AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
Capel Posted September 29, 2010 Author Posted September 29, 2010 Z-order is an ordering of overlapping two-dimensional objects, such as windows in a graphical user interface (GUI). In my case, the IE window I need to interact with may not be the currently active window (there could be a windows forms app on top), but I want to interact with the IE browser that is on top of all the other IE browser windows.
JohnOne Posted September 29, 2010 Posted September 29, 2010 Well it seems to me (and I'm experiencing deja-vu here) that winlist, either by design or not, puts them in z order, so in my example code $awin[1][0] is top of the IE z order. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
JohnOne Posted September 29, 2010 Posted September 29, 2010 Here being shown.#include <Array.au3> #include <IE.au3> $title = "[Class:IEFrame]" _IECreate("http://uk.yahoo.com/") _IECreate("http://www.bing.com/") _IECreate("http://www.google.com/") $awin = WinList($title) _ArrayDisplay($awin) WinActivate($awin[3][0]) $awin = WinList($title) _ArrayDisplay($awin) $awin = WinList($title) WinActivate($awin[2][0]) _ArrayDisplay($awin) $awin = WinList($title) WinActivate($awin[1][0]) _ArrayDisplay($awin) AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
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