Activating A Random Window
#1
Posted 23 February 2004 - 01:31 AM
In short
let's say i have those windows opened:
"1 - Wnd"
"2 - Wnd"
"3 - Wnd"
"Untitled - Notepad"
"Internet Explorer"
I want to active one of the first three (randomly). How could I do this?
Thanks
#2
Posted 23 February 2004 - 04:36 AM
- obtain a list of open windows (somehow???)
- put names or handles of windows into an array, say $myWins
- use Random(...) to pick a number 0 to UBound($MyWins)-1
- active the window specified by the randomly generated array element
I don't know how do step one, however
Another idea (not tested):
$RndNum = Random(1, 10) For $i = 1 to $RndNum Send("{AltDown}{Tab}{AltUp}") Next
Good Luck
#3
Posted 23 February 2004 - 05:22 AM
Step one brings up a valid point. We have no way to enumerate windows. At some point, we should probably address that. I think wrapping the API function GetWindow() may be the best method as you can create loops to emulate EnumWindows() and EnumChildWindows() or pretty much find anything in the z-order you want with that function.Here's a general idea:
- obtain a list of open windows (somehow???)
- put names or handles of windows into an array, say $myWins
- use Random(...) to pick a number 0 to UBound($MyWins)-1
- active the window specified by the randomly generated array element
I don't know how do step one, however
Another idea (not tested):
$RndNum = Random(1, 10) For $i = 1 to $RndNum Send("{AltDown}{Tab}{AltUp}") Next
Good Luck
#4
Posted 23 February 2004 - 06:03 AM
And possibly ProcEnum?WinEnum
and
RegEnumKeys
and/or
RegEnumValues
all go on the wishlist me thinketh...
Lar.
#5
Posted 23 February 2004 - 06:16 AM
#6
Posted 23 February 2004 - 04:11 PM
Opt("WinTitleMatchMode",2)
OPT???
I was busy waiting all night for the Columbus Day Bunny to come down my chimney and light fireworks in my pumpkin.There's so much wrong with that.Oh, I'm sorry, i forgot you were Jewish.
#7
Posted 23 February 2004 - 04:19 PM
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users





