advis0r Posted March 21, 2006 Share Posted March 21, 2006 hello anybody can help me with this, i want so sort an array with window handles but it doesnt work, only if i save them as strings (but then i cant use WinActive with this handle anymore!!) here's the sample code (also in the attachment) #include <Array.au3> $var = WinList("A") Dim $len = $var[0][0] Dim $HANDLES[1] Dim $STRING_HANDLES[1] For $i = 1 To $len _ArrayAdd($HANDLES, $var[$i][1]) _ArrayAdd($STRING_HANDLES, "" & $var[$i][1]) Next _ArrayDelete($HANDLES, 0) _ArrayDelete($STRING_HANDLES, 0) Dim $msg = "" $msg = $msg & "Handles: " $msg = $msg & _ArrayToString($HANDLES, " ") _ArraySort( $HANDLES ) $msg = $msg & @CRLF $msg = $msg & " sorted: " $msg = $msg & _ArrayToString($HANDLES, " ") $msg = $msg & @CRLF & @CRLF $msg = $msg & "StringHandles: " $msg = $msg & _ArrayToString($STRING_HANDLES, " ") $msg = $msg & @CRLF _ArraySort( $STRING_HANDLES ) $msg = $msg & " sorted: " $msg = $msg & _ArrayToString($STRING_HANDLES, " ") $msg = $msg & @CRLF MsgBox(0, "_ArraySort", $msg) Link to comment Share on other sites More sharing options...
advis0r Posted March 21, 2006 Author Share Posted March 21, 2006 i know that window handles are a special type and thus the > < operators dont seem to work in the _ArraySort method, am i right? i can make a work around with a 2 dimensional array and sort by the dim that holds the strings, and then use the handle-dimension... or you implement the <> for handles ;P Link to comment Share on other sites More sharing options...
seandisanti Posted March 21, 2006 Share Posted March 21, 2006 i know that window handles are a special type and thus the > < operators dont seem to work in the _ArraySort method, am i right?i can make a work around with a 2 dimensional array and sort by the dim that holds the strings, and then use the handle-dimension... or you implement the <> for handles ;Pwhy do you need to sort an array of window handles? i think your best bet would be to use WinList to generate your two dimensional array, then sort by the title dimension rather than the handle dimension. Link to comment Share on other sites More sharing options...
advis0r Posted March 21, 2006 Author Share Posted March 21, 2006 why do you need to sort an array of window handles? i think your best bet would be to use WinList to generate your two dimensional array, then sort by the title dimension rather than the handle dimension.coz i want to switch through the windows in the same order they were opened, i did use a 2dim array already and it works, but they can also just implement the operators >< for window handle type... Link to comment Share on other sites More sharing options...
seandisanti Posted March 21, 2006 Share Posted March 21, 2006 coz i want to switch through the windows in the same order they were opened, i did use a 2dim array already and it works, but they can also just implement the operators >< for window handle type... i'm pretty sure i've seen code by valik that does what you're looking for... do a search of the forum for z-order and you may find what you're looking for Link to comment Share on other sites More sharing options...
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