Cerb Posted February 23, 2004 Posted February 23, 2004 Well, let's say I have many windows and I want to activate random ones. Those I want to activate have the " - Wnd" string. 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
CyberSlug Posted February 23, 2004 Posted February 23, 2004 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 elementI 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}") NextGood Luck Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
Valik Posted February 23, 2004 Posted February 23, 2004 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 LuckStep 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.
Valik Posted February 23, 2004 Posted February 23, 2004 WinEnumandRegEnumKeysand/orRegEnumValuesall go on the wishlist me thinketh...Lar.And possibly ProcEnum?
CyberSlug Posted February 23, 2004 Posted February 23, 2004 Larry's "proof of concept" should go in the UDF library! Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
MattNis Posted February 23, 2004 Posted February 23, 2004 Opt("WinTitleMatchMode",2) OPT??? [quote]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.[/quote]
Nutster Posted February 23, 2004 Posted February 23, 2004 Opt() is a new alias for AutoItSetOption(). I guess the name was getting too long. David NuttallNuttall Computer Consulting An Aquarius born during the Age of Aquarius AutoIt allows me to re-invent the wheel so much faster. I'm off to write a wizard, a wonderful wizard of odd...
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