One Key for Two Functions (Click and Hold). Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Solid_Pliskin
Posts: 9
Joined: 12 Jan 2017, 23:36

One Key for Two Functions (Click and Hold).

28 Mar 2017, 16:11

Hello,

It's possible with AHK to have two functions with the same key ?

Example:

Key = E

When I click on this Key = E
When I HOLD the Key = F (until I release the key).


?

Thanks
GEV
Posts: 1002
Joined: 25 Feb 2014, 00:50

Re: One Key for Two Functions (Click and Hold).

28 Mar 2017, 16:23

Code: Select all

$E::
KeyWait, E, T0.2	; 200 ms
If (!ErrorLevel)
  Send, E
else
{
  Send, F
  KeyWait, E
}
return
Solid_Pliskin
Posts: 9
Joined: 12 Jan 2017, 23:36

Re: One Key for Two Functions (Click and Hold).

28 Mar 2017, 16:38

Nice, but not work properly.

When I hold the Key, it type only one time "F" and stop after that. I want it hold "F" while i Hold the Key E. In notepad for example, it should write "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF....." until I release the key E.

It's possible ?

Thanks ;)
Xeno234
Posts: 71
Joined: 24 Mar 2017, 18:14

Re: One Key for Two Functions (Click and Hold).  Topic is solved

28 Mar 2017, 17:17

Code: Select all

$E::
	KeyWait, E, T0.2	; 200 ms
	If (!ErrorLevel)
		Send, E
	else {
		while getkeystate("e", "p") {
			SendInput, F
			sleep 50
		}
	}
return
Solid_Pliskin
Posts: 9
Joined: 12 Jan 2017, 23:36

Re: One Key for Two Functions (Click and Hold).

30 Mar 2017, 14:54

Xeno234 wrote:

Code: Select all

$E::
	KeyWait, E, T0.2	; 200 ms
	If (!ErrorLevel)
		Send, E
	else {
		while getkeystate("e", "p") {
			SendInput, F
			sleep 50
		}
	}
return
Edit:

It finally works as I expected.

When I tried this for the first time, I do a mistake with it, but now, It works very well.

Thanks ;)

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: JPMuir and 331 guests