Run again and again a hotkey with primary key down

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
jorj escu
Posts: 6
Joined: 05 Jul 2019, 06:12

Run again and again a hotkey with primary key down

05 Jul 2019, 06:38

Hello,
I'm trying to run a hotkey many times with primary key down.
For example the key is Ctrl + U, but I want to keep pressing Ctrl while I press repeatedly the U key.
Is possible to do that?
User avatar
WalkerOfTheDay
Posts: 710
Joined: 24 Mar 2016, 03:01

Re: Run again and again a hotkey with primary key down

05 Jul 2019, 09:20

Something like this ?

This will hold the ctrl key when you press it once. After pressing it again it will release it.

Code: Select all

#NoEnv  ; for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
SetTitleMatchMode, 2

#IfWinActive, Untitled - Notepad <------- might be a good idea if you only want to use it in certain program (example for notepad)

$LControl:: 
Toggle := !Toggle
If (Toggle)
{
	Send {CtrlDown}
	ToolTip, CTRL = Down
} Else {
	Send {CtrlUp}
	ToolTip, CTRL = Up
}
Return
jorj escu
Posts: 6
Joined: 05 Jul 2019, 06:12

Re: Run again and again a hotkey with primary key down

05 Jul 2019, 10:42

Thank you WalkerOfTheDay, but actually... no.
I should mention "holding" the Ctrl key, and then pressing repeatedly C, or whatever.
But I figured out how to do it inspired by some posts from here:

^u up::
{
send, part%n%
n++
send ^+{left}
}

Very interesting your code also. I think I know where to use it elsewhere. ;)

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Leonardo_Portela and 169 guests