ControlSend Inputs not being received by some programs?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
The_Alexand
Posts: 1
Joined: 03 Jul 2022, 17:07

ControlSend Inputs not being received by some programs?

Post by The_Alexand » 03 Jul 2022, 17:11

Hello, so after some research I found some code for a wow multibox that I edited to use for GameBoy Emulators.
But I cant seem to get it to work.

I start out by looping through all the windows and saving the emulator window titles in an array. Then I check which one is #1 so that I can use that as my active window since the Control Send would go to #2.
(#3 is there temporarily since I am using it to test it on Calculator as well as Notepad)

The Functions work on Notepad, but they dont work on chrome, calculator or the emulator.
Can someone help me out?

Code: Select all

global GBANames:=[]
;WinGet, gbaid, List, Pokemon

WinGet, Window, List

Loop %Window%

{

Id:=Window%A_Index%

WinGetTitle, TVar , % "ahk_id " Id

IfInString, TVar, Pokemon
;tList.=TVar "`n" ;use this if you just want the list
GBANames.Push(TVar)
;Window%A_Index%:=TVar ;use this if you want an array
else
Sleep,1

}

;MsgBox %tList%
;MsgBox %Window1%
;MsgBox % GBANames[1]
;MsgBox % GBANames[2]

MsgBox % GBANames[1]
GBANames.Push("Calculator")
MsgBox % GBANames[3]

~Space::
ControlSend,, {Space}, % GBANames[2]
return

~NumPad1::
ControlSend,, {NumPad1}, % GBANames[3]
return

~NumPad2::
ControlSend,, {NumPad2}, % GBANames[3]
return

~NumPad3::
ControlSend,, {NumPad3}, % GBANames[3]
return

~NumPad4::
ControlSend,, {NumPad4}, % GBANames[2]
return

~NumPad5::
ControlSend,, {NumPad5}, % GBANames[2]
return

~NumPad6::
ControlSend,, {NumPad6}, % GBANames[2]
return

~NumPad7::
ControlSend,, {NumPad7}, % GBANames[2]
return

~NumPad8::
ControlSend,, {NumPad8}, % GBANames[2]
return

~NumPad9::
ControlSend,, {NumPad9}, % GBANames[2]
return

~enter::
ControlSend,, {enter}, % GBANames[2]
return

~right::
ControlSend,, right, % GBANames[2]
return

~left::
ControlSend,, left, % GBANames[2]
return

~up::
ControlSend,, up, % GBANames[2]
return

~down::
ControlSend,, down, % GBANames[2]
return

User avatar
mikeyww
Posts: 26848
Joined: 09 Sep 2014, 18:38

Re: ControlSend Inputs not being received by some programs?

Post by mikeyww » 03 Jul 2022, 18:42

Some windows do not respond to ControlSend. A workaround is to WinActivate and then Send.

User avatar
Xtra
Posts: 2750
Joined: 02 Oct 2015, 12:15

Re: ControlSend Inputs not being received by some programs?

Post by Xtra » 03 Jul 2022, 20:14

Have you tried a simple test script with the wintitle as plain text?
Start simple to verify it's possible.

Post Reply

Return to “Ask for Help (v1)”