Clicking in a certain program

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
N8sgr8
Posts: 1
Joined: 15 May 2021, 19:25

Clicking in a certain program

Post by N8sgr8 » 15 May 2021, 19:30

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?

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

Re: Clicking in a certain program

Post by mikeyww » 15 May 2021, 19:40

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.

Post Reply

Return to “Ask for Help (v1)”