Sending Keystrokes to Multiple Windows Topic is solved

Ask gaming related questions (AHK v1.1 and older)
jkpwk213
Posts: 7
Joined: 23 Jan 2022, 02:17

Sending Keystrokes to Multiple Windows

23 Jan 2022, 02:31

I apologize if I'm asking something super obvious, I'm very new to this scripting. I found this code that someone else posted and was hoping I could change it to where it wouldn't look for alpha character but instead look for arrow directions only? (Up, Down, Left, Right)

I'm just not sure what to put in place of the alphabetized list? Or would I need to declare those keystrokes different?


Thanks!

Code: Select all

SetTitleMatchMode, 2
WinGet, Hwnd_List, List , Notepad

Loop, Parse, % "abcdefghijklmnopqrstuvwxyz"
	Hotkey, %A_LoopField%, LoopSend
return

LoopSend:
	Loop, %Hwnd_List%
	{
		Hwnd := Hwnd_List%A_Index%
		ControlSend,, %A_ThisHotkey%, ahk_id %Hwnd%
	}
return

Esc::ExitApp
Rohwedder
Posts: 7768
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Sending Keystrokes to Multiple Windows  Topic is solved

23 Jan 2022, 03:14

Hallo,
try:

Code: Select all

SetTitleMatchMode, 2
WinGet, Hwnd_List, List, ahk_exe NOTEPAD.EXE
Loop, Parse, % "abcdefghijklmnopqrstuvwxyz" ;Test
	Hotkey, $%A_LoopField%, $Up ;Test
$Up::
$Left::
$Down::
$Right::
Key := "{" SubStr(A_ThisHotkey, 2) "}"
Loop, %Hwnd_List%
	ControlSend,, %Key%,% "ahk_id " Hwnd_List%A_Index%
return
Esc::ExitApp
if you don't need the 2 Test lines, just delete them.
jkpwk213
Posts: 7
Joined: 23 Jan 2022, 02:17

Re: Sending Keystrokes to Multiple Windows

23 Jan 2022, 09:16

This worked perfectly thank you!

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: No registered users and 78 guests