Spam 'f' key for a specific window

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
segolore
Posts: 1
Joined: 19 Apr 2024, 10:37

Spam 'f' key for a specific window

19 Apr 2024, 10:42

Hello! I'm new to AHK and I was hoping to ask for help on how to spam 'f' key every three seconds for a specific window/application. I'd like to start and end the script with f1. Thank you!
User avatar
mikeyww
Posts: 27165
Joined: 09 Sep 2014, 18:38

Re: Spam 'f' key for a specific window

19 Apr 2024, 16:00

Welcome to this AutoHotkey forum!

Code: Select all

#Requires AutoHotkey v1.1.33.11
winTitle := "ahk_exe Notepad.exe"
ctl      := "RichEditD2DPT1" ; Win 11

#If WinExist(winTitle)
F1::
If !on := !on {
 SetTimer Spam, Off
 SoundBeep 1000
 Return
}
SetTimer Spam, 3000
Spam:
If on
 ControlSend % ctl, f, % winTitle
Return
#If
If you are new to AHK, I recommend using its current version, which is v2, instead of this older deprecated version that is no longer developed.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: doanmvu and 73 guests