How can i make the same key dual function(long press)? Duplicate Error

Discussion, questions and support.
Post Reply
vincer
Posts: 6
Joined: Jan 13th, ’23, 17:18

Post by vincer » Feb 22nd, ’23, 18:13

Im trying a setup where the same key have 2 different functions in the same application, single click vs long press- but trying to do so pops up a 'duplicate entry' error message and FastKeys just doesnt allow it

Im a bit lost, i tought long press and double click main use was precisely getting more out of the same key. Not allowing it feels contradictory- seems like the app cant see the difference between single/long/double clicks, if it uses the same key shortcut for the same window(app) its flagged as duplicate.
Limitation, bug?

Meanwhile, is there any workaround i could do to achieve that? The way autohotkey scripts are powerful i imagine it can be done via scripting, but im clueless how such a script would be. Any help?
vincer
Posts: 6
Joined: Jan 13th, ’23, 17:18

Post by vincer » Feb 23rd, ’23, 13:11

Found an autohotkey script that solved it for me, i will share it here in case anyone in the future with a similar issue may find it.

Solution aside id hope this is taken as a sugestion/feature request- with all the ui/ux FastKeys provide for relying less on scripting via ahk i feel this case is more of a critical flaw, since it works against the expectations and how things should work from fastkeys own definitions and UX- it took me awhile to figure out why something wasnt working the way it should and have been working in all other scenarios so far.

Here is the script:
Create a shortcut as command

Code: Select all

KeyX::
	KeyWait, KeyX, T0.4 ;edit T0.X to change the time waited
	
	if (ErrorLevel)
		Send {KeyY} ;long press effect

	else {
		KeyWait, KeyX, D T0.1

		if (ErrorLevel)
			Send {KeyX} ;single click, normal key usage- here the same key(ex: if its a, no longpress would print a)
		
		else
			Send {KeyZ} ;double click effect
	}

	KeyWait, KeyX
return
Substitute KeyX with the main key thats being triggered
KeyY and KeyZ are just placeholders for other effects, can be other keys or any other command/script in those cases
User avatar
Tom
Posts: 791
Joined: Nov 24th, ’15, 23:39

Post by Tom » Feb 23rd, ’23, 18:43

Thanks for posting the solution. We will see if this could be improved in one of the next updates.
Post Reply