Actually it works like this -> You press Ctrl + Left and in my Programm it press Ctrl + Right in the background . But now i need that this code press every time Ctrl + Right in a Loop.
i try to change this code:
Code: Select all
#Persistent
SetTimer, PressTheKey, 1000
Return
PressTheKey:
Send, ^{right}
Return
Code: Select all
keyMap:={ "^left" :"^{right}"}
Hotkey IfWinExist, % title
for pressedkey,sendkey in keyMap {
act:=func("sendToInfinity").bind(sendkey)
Hotkey % pressedkey, % act, On
}
return
Here is the Main code:
Code: Select all
DetectHiddenWindows On
sendMode Input
title:="ahk_exe Infinity.exe"
keyMap:={ "^left" :"^{right}"}
Hotkey IfWinExist, % title
for pressedkey,sendkey in keyMap {
act:=func("sendToInfinity").bind(sendkey)
Hotkey % pressedkey, % act, On
}
return
sendToInfinity(key){
WinGet, winList, List, % title
Loop, % winList {
ControlFocus , , % "ahk_id " winList%A_Index%
ControlSend, , % key, % "ahk_id " winList%A_Index%
}
return
}
I would be grateful if someone could help me.