Send key to multiple game windows Topic is solved

Ask gaming related questions (AHK v1.1 and older)
Guillaume

Send key to multiple game windows  Topic is solved

18 Oct 2017, 17:14

Hi,

I am trying to create a loop and send the same key to multiple game windows. The idea is to press the "loot" key on several game clients.
This is my first time trying to code with AHK.

I managed to send the same key over and over again on a single client using this code :

Code: Select all

#SingleInstance force
#Persistent
#NoEnv

SetTimer, lootStuff, 250
return

lootStuff:
  IfWinActive ahk_class ArenaNet_Dx_Window_Class 
  {
      SendInput {F12}
  }

return
I am now trying to Send F12 to multiple accounts.
The core issue is that all the clients share the same name "Guild Wars 2" so we need to get the process IDs.

Here is the terribly bad code I've come up with :

Code: Select all

#Persistent

WinGet, IDs, List , Guild Wars 2 ; get a list of all windows which match this windowTitle

Loop, %ids%
{
	_hWin := ids%A_Index%
	GroupAdd, WinGroup, ahk_id %_hWin%
}
return
1::

SetTimer, lootStuff, 250

lootStuff:

	SendInput {f}, ahk_group WinGroup
return
And yeah, it is definitely not working. Any ideas ?

Thanks,
Guillaume
User avatar
Reloaded
Posts: 283
Joined: 25 Aug 2017, 08:48

Re: Send key to multiple game windows

19 Oct 2017, 13:00

You can try to add A toggle, like this

Code: Select all

Setbatchlines -1 
#Maxthreadsperhotkey 2

F::

If toggke := !Toggle
Loop

{
if toggle 
{

;Add here your Script 

}
else
	break
}
return

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: yuu453 and 73 guests