Page 1 of 1

Clicking in a certain program

Posted: 15 May 2021, 19:30
by N8sgr8
I wanted to edit a AHK script i made so that it could click into a certain window, so that if, while it is running, something steals the cursor away from it, it would continue to work, is this possible?

Re: Clicking in a certain program

Posted: 15 May 2021, 19:40
by mikeyww
If you mean that you want to activate the window, you can use WinActivate. You can also use WinWaitNotActive in a Loop, to trigger that if needed.

Code: Select all

Run, notepad.exe
WinWaitActive, ahk_exe notepad.exe
Loop {
 WinWaitNotActive
 WinActivate
}
An alternative could be to set the window to on-top status, though that does not necessarily keep it active.