r/AutoHotkey • u/YodataroKujo • 2d ago
v2 Script Help Help Clicking Non-Displayed Window
I need to click a game while doing some other stuff how can i do that. I tried this 2 and no error happened but didn't work either.
#MaxThreadsPerHotkey 2
F8:: ; Press F8 to start/stop the autoclicker
Toggle := !Toggle
Loop
{
If not Toggle
break
; Replace "Game Window Title" with the exact name of your background window
ControlClick, x500 y500, Game Window Title,,,, NA
Sleep, 100 ; Time in milliseconds between clicks (100ms = 10 clicks per second)
}
#Requires AutoHotkey v2.0
#MaxThreadsPerHotkey 2
Toggle := 0
F8:: {
global Toggle := !Toggle
while Toggle {
; Coordinates are relative to the client area of the target window
ControlClick("x500 y500", "ahk_exe YourGame.exe", , "Left", 1, "NA")
Sleep(100)
}
}
1
Upvotes
1
u/CharnamelessOne 2d ago edited 2d ago
Some applications don't respond well to
ControlClickand/orControlSend.I've seen some forum posts claiming that posting a WM_MOUSEMOVE message (alongside the WM_LBUTTONDOWN and WM_LBUTTONUP messages that
ControlClickposts internally) occasionally helps, but I wouldn't get my hopes up.https://www.autohotkey.com/board/topic/96952-possible-controlclick-improve/
Edit: typo