Here's (a part of) my script on send commands:
Code: Select all
#MaxThreadsPerHotkey 2
#r::Pause
#f::
loop
{
send ``
send x
send 0
send z
send ``
send 3
send {space}
sleep 1100
send ``
sleep 1100
send x
send 0
send z
send ``
send 4
send {space}
sleep 1200
send ``
sleep 1200
}
return
I did search how to write script using ControlSend, buuuuuut it appeard not to work completely fine.
Here's the new script that works:
Code: Select all
#MaxThreadsPerHotkey 2
wintitle = "Game name"
SetTitleMatchMode, 2
#SingleInstance Force
#r::Pause
#f::
loop
{
controlsend,,{Enter}, %wintitle%
sleep 500
}
Return
Part of script I tried to use:
Code: Select all
#MaxThreadsPerHotkey 2
wintitle = "Game name"
SetTitleMatchMode, 2
#SingleInstance Force
#r::Pause
#f::
loop
{
controlsend,,``, %wintitle%
controlsend,,x, %wintitle%
controlsend,,0, %wintitle%
controlsend,,z, %wintitle%
controlsend,,``, %wintitle%
controlsend,,3, %wintitle%
controlsend,,{space}, %wintitle%
sleep 1000
controlsend,,``, %wintitle%
sleep 300
controlsend,,x, %wintitle%
controlsend,,0, %wintitle%
controlsend,,z, %wintitle%
controlsend,,``, %wintitle%
controlsend,,4, %wintitle%
controlsend,,{space}, %wintitle%
sleep 1000
controlsend,,``, %wintitle%
sleep 300
}
Return
EDIT:
In my game the enter key is used to open and close chat and when chat is open keys work completely fine, but they don't work when chat is closed.
So script that works looks like:
Code: Select all
#MaxThreadsPerHotkey 2
wintitle = "Game name"
SetTitleMatchMode, 2
#SingleInstance Force
#r::Pause
#f::
loop
{
controlsend,,{enter}, %wintitle%
sleep 500
controlsend,,``, %wintitle%
controlsend,,x, %wintitle%
controlsend,,0, %wintitle%
controlsend,,z, %wintitle%
controlsend,,``, %wintitle%
controlsend,,3, %wintitle%
controlsend,,{space}, %wintitle%
sleep 1000
controlsend,,``, %wintitle%
sleep 300
controlsend,,{enter}, %wintitle%
sleep 500
}
Return
EDIT2:
I tried solutions with ahk_parent and ahk_id from other threads and it worked same - only on the chat.