Page 1 of 1

Combining long press and double tapping scripts

Posted: 06 Apr 2024, 18:23
by Joey5
Hi all,
The following two scripts work well separately but not together. Any chance of combining it so that one script can send short press/single tap, long press, double tap and triple press?
Thank you in advance.

Code: Select all


#IFWinActive, ahk_exe notepad.exe
d::
 {
   count++
   settimer, actions, 350
 }
return

actions:
 {
   if (count = 1)
    {
      send d
    }
   else if (count = 2)
    {
      send e
    }
   else if (count = 3)
    {
      send f
    }
   count := 0
 }
return
#IFWinActive

Code: Select all

#IFWinActive, ahk_exe notepad.exe
$d::
keywait, d, T0.5
if errorlevel {
	SoundBeep
	Send e
} else Send d
keywait, d
; d key down would immediately trigger $d:: again
return
#IFWinActive

Re: Combining long press and double tapping scripts

Posted: 06 Apr 2024, 18:31
by flyingDman
Try Morse: viewtopic.php?f=76&t=127450&p=563668&hilit=morse#p563668
V2 example

Re: Combining long press and double tapping scripts

Posted: 06 Apr 2024, 19:10
by Joey5
@flyingDman thank you. I am hoping to avoid using a modifier key.

Re: Combining long press and double tapping scripts

Posted: 06 Apr 2024, 19:16
by flyingDman
My example includes one but it does not require one.