Iznobad Posted November 25, 2008 Share Posted November 25, 2008 (edited) Hey Autoit'ers,I've been using the wow-related script at http://www.autoitscript.com/forum/index.php?showtopic=13749 to send "F12" repeatedly to my World of Warcraft clientNow I've graduated to run 5 accounts of wow at once on the same computer and can only get it to send the "F12" to the active window.The real question is then: How do I send the same keyclick to 5 windows that have the same window title? Even if they're in the background...?I can rename the exe files, if that helps. If I can just get help on how to loop through the windows, i can probably figure out the clicking myselfI've tried the search but had no luck, maybe i was using the wrong search terms.Regards,IzEDIT: Solved. check my last post Edited November 25, 2008 by Iznobad Link to comment Share on other sites More sharing options...
Valuater Posted November 25, 2008 Share Posted November 25, 2008 Just use send Alt+Tab and move to the next window 8) Link to comment Share on other sites More sharing options...
Iznobad Posted November 25, 2008 Author Share Posted November 25, 2008 Just use send Alt+Tab and move to the next windowThanks, I see what you mean, but it's not as easy as that. You see, I'm actively playing in one of the windows and the others should remain in the background. ALT-TAB'ing every second to a new window would seriously confuse me I guess i need something like this (pseudo);every 1 second { For (every window called "World of Warcraft") { Send key "F12" (even if in the background) }} Link to comment Share on other sites More sharing options...
Iznobad Posted November 25, 2008 Author Share Posted November 25, 2008 (edited) I think I found a way to find my 5 windows. In such an unlikely place as the autoit help file */me feels noobish* WinList ( ["title" [, "text"]] ) gives a list of windows that match my title. follow up by a for loop,... The only thing missing is now a way to send keys to background window. any ideas? Edit: looks like controlSend is the thing.. only trouble is will it work on multiple same-named windows.... only one way to find out Edited November 25, 2008 by Iznobad Link to comment Share on other sites More sharing options...
Iznobad Posted November 25, 2008 Author Share Posted November 25, 2008 Edit: looks like controlSend is the thing.. only trouble is will it work on multiple same-named windows.... only one way to find out ControlSend worked on the most-recently-active window with the right title. it di not send to all my open notepads Link to comment Share on other sites More sharing options...
Iznobad Posted November 25, 2008 Author Share Posted November 25, 2008 (edited) ControlSend worked on the most-recently-active window with the right title. it di not send to all my open notepads I've solved it. It turns out ControlSend accepts a window handle instead of a title After that it was a simple matter to loop throught the winList and send keys. her's my notepad experiment. it will send to any open notepad windows $var = WinList("[CLASS:Notepad]") For $i = 1 to $var[0][0] ; Only display visble windows that have a title $title = $var[$i][0] $handle = $var[$i][1] If $title <> "" AND IsVisible($handle) Then MsgBox(0, "Details", "Title=" & $title & @LF & "Handle=" & $handle) $controlid = "[CLASS:Edit; INSTANCE:1]" ControlSend($handle,"",$controlid ,"text to send") EndIf Next Func IsVisible($handle) If BitAnd( WinGetState($handle), 2 ) Then Return 1 Else Return 0 EndIf EndFunc Now I'll just adapt it to my game. I think my @controlid will need to be changed. Edited November 25, 2008 by Iznobad Link to comment Share on other sites More sharing options...
ARozanski Posted November 25, 2008 Share Posted November 25, 2008 Hi, i'm sorry, but i couldn't help but gain some interest from what you are doing. Can you please explain how you have achieved to send something to each window without ALT-TABbing through each one... Link to comment Share on other sites More sharing options...
Iznobad Posted November 25, 2008 Author Share Posted November 25, 2008 Hi, i'm sorry, but i couldn't help but gain some interest from what you are doing. Can you please explain how you have achieved to send something to each window without ALT-TABbing through each one...Yes, of course. Tak a look at my code above again.the WinList call at the start assigns an array of window handles to my variable $varThen i loop through that array and do some key sending to each window. The ControlSend function does not care whether your windows are active or not.Your best bet for understanding is to open up 2-3 notepad windows and runs my scriptDid that help? Link to comment Share on other sites More sharing options...
ARozanski Posted November 25, 2008 Share Posted November 25, 2008 Yes, of course. Tak a look at my code above again.the WinList call at the start assigns an array of window handles to my variable $varThen i loop through that array and do some key sending to each window. The ControlSend function does not care whether your windows are active or not.Your best bet for understanding is to open up 2-3 notepad windows and runs my scriptDid that help?gee, thanks alot! Link to comment Share on other sites More sharing options...
Iznobad Posted November 25, 2008 Author Share Posted November 25, 2008 gee, thanks alot! You're welcome Meanwhile i managed to get it to work on wow. Here is my final solution that sends a {SPACE} to every World of Warcraft window, even if they're in the background or minimized: $timeMin = 957 $timeMax = 2619 $key = "{SPACE}" ;get a list if window handles that match the text $winList = WinList("World of Warcraft") ;run until killed/paused in the notification area While 1 ;loop through the windows For $i = 1 to $winList[0][0] $title = $winList[$i][0] $handle = $winList[$i][1] $controlid = "" $text = "" ControlSend($handle,$text,$controlid,$key) ;take a break to seem less like a macro $sleepTime = Random($timeMin, $timeMax) Sleep($sleepTime) Next WEnd 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