Two shortcuts on one key, quick press and hold

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
mic22
Posts: 2
Joined: 16 Sep 2019, 03:33

Two shortcuts on one key, quick press and hold

16 Sep 2019, 03:47

I want to use my right shift key as a up arrow when i tap it, but behave as a regular shift key when I press it and combine with different keys.
My keyboard looks like this:
Image Broken Link for safety

I hate pressing up and down arrow keys, since they are so small. I want to use both up and down arrow keys as a down arrow, and use quick shift press as up arrow.

Could anybody help? I have around 20 keystrokes remapped and some scripts written, but I don't know how to go about this idea.

That is my current code:

Code: Select all

$RShift::
KeyWait, RShift
If A_TimeSinceThisHotkey > 300
	Send {Shift}
Else
{
Send {Up}
}
Return
Shift now works as up arrow, but when I press it and hold it, it doesn't behave as shift
ilhom
Posts: 52
Joined: 19 Aug 2019, 17:58

Re: Two shortcuts on one key, quick press and hold

18 Sep 2019, 11:12

You can add a timeout to KeyWait, and then use ErrorLevel to determine if the key is tapped or held down.

I also added a bit more to your If statement to make the shift key function like it normally would.

Code: Select all

$RShift::
KeyWait, RShift, T0.3
If (ErrorLevel = 1)
{
	Send {Shift Down}
	KeyWait, RShift
	Send {Shift Up}
}
Else
	Send {Up}
Return

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Anput and 333 guests