Jump to content

Recommended Posts

Posted

I have 4 windows of the same application open and I want to send a keystroke to all 4 of them at the same time. I've been using ControlSend but it will only send to the most recent window that had focus.

I've been doing some reading, and I think I'm going to have to send the hotkey via the handles of the windows. Unfortunately, I've spent about an hour trying to get it done with no luck. Been trying with "WinList".

Anyone have some working code where you can put the name of a window and it will grab the handles of all instances of that application, then send a hotkey (or anything really) to each instance of the app?

Really appreciate any help, stumped here.

Posted

I'll post what code I have so far:

HotKeySet("{F3}", "Toggle")
Global $speed = 2000
; Toggle run/pause
Func Toggle()
$Toggle = Not $Toggle
  While $Toggle
  Local $var = WinList("Diablo III")
For $i = 1 To $var[0][0]
    If IsVisible($var[$i][1]) Then
ControlSend($var[$i][1],"","","3")
    EndIf
Next
  Sleep($speed)
WEnd
EndFunc

But, it doesn't work. Not sure if I have just a typo or I'm just plain doing it wrong. Help please!

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...