Sending keystrokes to multiple windows

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
123newuser

Sending keystrokes to multiple windows

20 Sep 2018, 07:27

Hello, this is my first post. I would like to control multiple windows of separate VisualBoyAdvance emulator executables at the same time. So when i press F1 i want it to affect all vba windows and not just the active one (that i last clicked on). So ive been trying to write a script for that but im not a programmer at all and didnt find a solution in the tutorial either. This is what i have so far, i tried modifying a script wow players used for multiboxing:

Description from the website i found it on (the post/article is about 10 years old): "Although it does take a bit to set up, this is an example of setting up the "2" key to be sent to both World of Warcraft clients."

WinGet, wowid, List, World of Warcraft

~2::
KeyWait 2
IfWinActive, World of Warcraft
{
ControlSend,, 2, ahk_id %wowid1%
ControlSend,, 2, ahk_id %wowid2%
Return
}

////// BELOW is the modified version i tried :
WinGet, wowid, List, VisualBoyAdvance emulator

~9::
KeyWait 2
IfWinActive, VisualBoyAdvance emulator
{
ControlSend,, {F1}, ahk_id %wowid1%
ControlSend,, {F1}, ahk_id %wowid2%
Return
}

Escape::
ExitApp
Return

Needless to say its not working. Before i ask any more specific questions, how would you guys go about this? In principle i thought something like this:

(key that triggers it)

(a send command) (what to send) (where to send it, maybe filepath to the executable)

(same as above but for other executables)

Return
123newuser

Re: Sending keystrokes to multiple windows

21 Sep 2018, 10:35

Solved. Code:
WinGet, ID, List, VisualBoyAdvance

$9::
; KeyWait, 9

IfWinActive, VisualBoyAdvance
{
Loop, %ID%
{
X := ID%A_Index%
ControlSend,, {F1}, ahk_id %X%
}
}
Return

Escape::ExitApp

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: -Elaphe-, downstairs, Frogrammer and 286 guests