Page 3 of 6

Re: TapHoldManager - Long Press / Multi Tap / Multi Tap and Hold / Any number of Taps / Multi-Keyboard / Joystick button

Posted: 01 Oct 2020, 07:40
by LimitlessEvo
@evilCIt works now. Thank you!

Re: TapHoldManager - Long Press / Multi Tap / Multi Tap and Hold / Any number of Taps / Multi-Keyboard / Joystick button

Posted: 27 Dec 2020, 03:47
by tfpp
Has anyone managed to evilC's THM to reprogram the surface pen side buttons?
I would like to double click the lower side button to map to undo previous action, i.e. CTRL-Z

Re: TapHoldManager - Long Press / Multi Tap / Multi Tap and Hold / Any number of Taps / Multi-Keyboard / Joystick button

Posted: 03 Jan 2021, 15:17
by Avastgard
Hi there, and sorry it took me so long to report back, but I only managed to test this now. Your pass-through code worked fine, but I had to change one isHold to taps to get it working. There is only a minor thing about it that hopefully someone could help me fix: since I tell the script to wait a while to send a characater, what is usually happening is that during normal typing, a character handled by TapHoldManager will sometimes be typed after a character when it was supposed to come before it. So, for example, in a script like this:

Code: Select all

thm.Add("-", Func("FuncEditUserCommands"))

FuncEditUserCommands(isHold, taps, state)
{
  if (taps)
  {
    if (taps == 1)
      Send -
    else if (taps == 2)
      Send, {Space}-{Space}
    else if (taps == 3)
      Run, "C:\Program Files\AutoHotkey\SciTE\SciTE.exe" "C:\Users\Avastgard\Desktop\UserCommands.ahk"
  }
}
sometimes typing "e-mail" will result in "em-ail", because I hit "m" before the script could send "-". I know I could simply reduce tapTime, but this in turn makes triple tapping more difficult, as I hould have to press "-" incredibly fast to execute the specified action. So, is there a way to make sure whatever I type after "-" only gets sent after tapTime expires?

As for this part of the code:
evilC wrote:
27 Jun 2020, 20:11
Only support for the same key is built into the library, but no reason you could not implement that functionality yourself by just subscribing to e and space, and only enabling the space subscription once e was tapped twice

Code: Select all

#include Lib\TapHoldManager.ahk

thm := new TapHoldManager()

thm.add("e", func("eFunc")) 
thm.add("Space", func("spaceFunc"))
thm.PauseHotkey("Space")

eFunc(isHold, taps, state){
    global thm
    if (taps == 2 && !isHold){
        thm.ResumeHotkey("Space")
    }
}

spaceFunc(isHold, taps, state){
    global thm
    if (taps == 1 && isHold && state){
        thm.PauseHotkey("Space")
        Msgbox You tapped e twice then held space
    }
}
The quoted part of the code you provided (tap followed by hold) worked, but apparently it only works every other time (works once, doesn't work the next time, works the following time and so on). Do you have any idea why this is happening and how to fix it?

Re: TapHoldManager - Long Press / Multi Tap / Multi Tap and Hold / Any number of Taps / Multi-Keyboard / Joystick button

Posted: 19 Mar 2021, 04:35
by Avastgard
Avastgard wrote:
03 Jan 2021, 15:17
Hi there, and sorry it took me so long to report back, but I only managed to test this now. Your pass-through code worked fine, but I had to change one isHold to taps to get it working. There is only a minor thing about it that hopefully someone could help me fix: since I tell the script to wait a while to send a characater, what is usually happening is that during normal typing, a character handled by TapHoldManager will sometimes be typed after a character when it was supposed to come before it. So, for example, in a script like this:

Code: Select all

thm.Add("-", Func("FuncEditUserCommands"))

FuncEditUserCommands(isHold, taps, state)
{
  if (taps)
  {
    if (taps == 1)
      Send -
    else if (taps == 2)
      Send, {Space}-{Space}
    else if (taps == 3)
      Run, "C:\Program Files\AutoHotkey\SciTE\SciTE.exe" "C:\Users\Avastgard\Desktop\UserCommands.ahk"
  }
}
sometimes typing "e-mail" will result in "em-ail", because I hit "m" before the script could send "-". I know I could simply reduce tapTime, but this in turn makes triple tapping more difficult, as I hould have to press "-" incredibly fast to execute the specified action. So, is there a way to make sure whatever I type after "-" only gets sent after tapTime expires?

As for this part of the code:
evilC wrote:
27 Jun 2020, 20:11
Only support for the same key is built into the library, but no reason you could not implement that functionality yourself by just subscribing to e and space, and only enabling the space subscription once e was tapped twice

Code: Select all

#include Lib\TapHoldManager.ahk

thm := new TapHoldManager()

thm.add("e", func("eFunc")) 
thm.add("Space", func("spaceFunc"))
thm.PauseHotkey("Space")

eFunc(isHold, taps, state){
    global thm
    if (taps == 2 && !isHold){
        thm.ResumeHotkey("Space")
    }
}

spaceFunc(isHold, taps, state){
    global thm
    if (taps == 1 && isHold && state){
        thm.PauseHotkey("Space")
        Msgbox You tapped e twice then held space
    }
}
The quoted part of the code you provided (tap followed by hold) worked, but apparently it only works every other time (works once, doesn't work the next time, works the following time and so on). Do you have any idea why this is happening and how to fix it?
@evilC, is there anyway to solve the problem in my script above?

Re: TapHoldManager - Long Press / Multi Tap / Multi Tap and Hold / Any number of Taps / Multi-Keyboard / Joystick button

Posted: 28 Aug 2021, 17:45
by SteveMylo
Anyone know why this script works perfectly without THM function, but when inside THM it can't seem to read vTab++ in the script. Here is the normal script which works great that increments a TAB by +1 every time i press the hotkey z:: (starting off on 2 tabs, hence the label)

Code: Select all

#NoEnv
SendMode Input
#SingleInstance, Force
#Persistent 

vTab:= 2
z::
SendEvent {Tab %vTab%} 
Sleep 11
SendEvent {Enter}
Sleep, 111
vTab++    
return
But when inside THM the increment vTAB++ doesn't seem to work. I've tried Gosubs and LABELS, (which usually works) and even Gosubs pointing to a new function and still doesn't work.

Code: Select all

#include C:\Users\Mylo\Documents\AutoHotkey\SCRIPTS_STARTUP\TapHoldManager-master\lib\TapHoldManager.ahk


thm := new TapHoldManager()	
thm.Add("x", Func("xtests"))

xtests(isHold, taps, state){ 	
if (isHold=0) & (taps=1) & (state){
  
vTab:= 2
SendEvent {Tab %vTab%} 
Sleep 44
SendEvent {Enter}
Sleep, 111
vTab++    
return
  
}
}
return

Re: TapHoldManager - Long Press / Multi Tap / Multi Tap and Hold / Any number of Taps / Multi-Keyboard / Joystick button

Posted: 24 Nov 2021, 07:15
by SteveMylo
Avastgard wrote:
19 Mar 2021, 04:35
sometimes typing "e-mail" will result in "em-ail", because I hit "m" before the script could send "-". I know I could simply reduce tapTime, but this in turn makes triple tapping more difficult
I use this loop script below.... so when my mouse turns into an IBeam in a text field, it suspends the script instantly so I can type what I want. Not sure if that helps
Place it after where you declare you hotkeys. e.g. thm.Add("~x", Func(""))

Code: Select all

thm := new TapHoldManager()
thm.Add("~x", Func("x_Shortcut"))

;;;;;;;;;;;;;;;;;;;  My Loop script
Loop  
{
	
	while A_cursor = "IBeam"
	{
		Sleep, 222
		Suspend, on
	}

	while A_cursor != "IBeam"
	{
		Sleep, 222
		Suspend, off
	}
}
;;;;;;;;;;;;;;;;;;;  END  My Loop script

x_Shortcut(isHold, taps, state){ 
if (isHold=0) & (taps=1) & (state){
; Your Script

Re: TapHoldManager - Long Press / Multi Tap / Multi Tap and Hold / Any number of Taps / Multi-Keyboard / Joystick button

Posted: 24 Nov 2021, 07:19
by SteveMylo
@evilC Love your script. Is there a way to change the hotkey from a compiled script from an .ini file?
Technically I gues, you just need to change one letter right? e.g. Change the "x" to something else from an .ini file =====> thm.Add("~x", Func("shortcut"))

But I don't know how.

Many thanks.

Re: TapHoldManager - Long Press / Multi Tap / Multi Tap and Hold / Any number of Taps / Multi-Keyboard / Joystick button

Posted: 24 Jan 2022, 13:01
by jkwaza
Hi, after getting great results from AutoHotInterception, I'd now like to add double tap functionality to some keys using InterceptionTapHold.ahk.
Trouble is I cannot see how to integrate the key code (as seen using Monitor.ahk). In my script for example it uses (code=1) to reference the Escape key, which of course is not the same as "1".

How can I listen out for the key code number of the USB keyboard I'm subscribed to instead?

Re: TapHoldManager - Long Press / Multi Tap / Multi Tap and Hold / Any number of Taps / Multi-Keyboard / Joystick button

Posted: 24 Jan 2022, 15:08
by SteveMylo
jkwaza wrote:
24 Jan 2022, 13:01
How can I listen out for the key code number of the USB keyboard I'm subscribed to instead?
Hi, this tutorial explains the whole set up for 2nd keyboard. It’s a long tutorial & that section doesn’t start till half way through. Sorry if it’s not what your asking.
[youtube] https://youtu.be/gZxebHjsXyw[/youtube]

Re: TapHoldManager - Long Press / Multi Tap / Multi Tap and Hold / Any number of Taps / Multi-Keyboard / Joystick button

Posted: 24 Jan 2022, 16:02
by jkwaza
Hi, this tutorial explains the whole set up for 2nd keyboard. It’s a long tutorial & that section doesn’t start till half way through. Sorry if it’s not what your asking.
https://youtu.be/gZxebHjsXyw
That is a truly brilliant tutorial video. So concise and simply put. Thank you.

Unfortunately it didn't answer my question.

Perhaps there isn't an obvious way to use the scan/key code number like you would using AutoHotInterception.

Re: TapHoldManager - Long Press / Multi Tap / Multi Tap and Hold / Any number of Taps / Multi-Keyboard / Joystick button

Posted: 16 Feb 2022, 13:21
by BeerBread
Hey guys! Thanks for @evilC for making this script! This looks so cool! I'm sort of having trouble executing taps in my code and I'm kind of at a loss on what's happening. I'm also running AHI in the same script, so I'm not sure if that's causing any conflicts. I'm also using this video https://youtu.be/gZxebHjsXyw that everyone's been referencing in the thread. Anything helps!

Code: Select all

ITH1.Add("L", Func("Func1"))
Func1 (isHold, taps, state)
	{	
		if (taps=1)
		{
			Send,{1} 
			Send, {tab 5}
			Send, {O}
			Sleep, 300
			Send, {tab 3}
			Sleep, 300
			Send,{2000}
			Send,{tab}
		}
		
		if (taps=2)
		{
			Send,{1}
			Send, {tab 5}
			Send, {C}
			Sleep, 300
			Send, {tab}
		}		
	}
Here's my header too if that helps

Code: Select all

IfExist, %I_Icon%
Menu, Tray, Icon, %I_Icon%
;return
#NoEnv  ; Recommended 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.

#SingleInstance force
#Persistent
#include <AutoHotInterception> ; ! ! ! Without this external library AHI Scripts won't work.
#include <TapHoldManager> ; ! ! ! Without this external library THM Scripts won't work.
#include <InterceptionTapHold> ; ! ! ! Without this AHI Scripts won't work.

#UseHook ;For Remote Desktop to work.

AHI := new AutoHotInterception() ; Initializing Interception
ITH1 := new InterceptionTapHold(AHI, keyboardId) ; Initializing Interception Tap Hold (ITH)
;ITH1.Add("L", Func("Func1")) - I wasn't sure what was happening. I've been toggling this within and outside of the header

keyboardId := AHI.GetKeyboardId(0x1A2C, 0x4094) ; ; Retrieving the ID of the keyboard inside the Windows

;This function begins the process of intercepting each individual key and redirecting the thread accordingly to corresponding conditions inside of the callback function. Keys are empty if there is no specified "IF" condition for them.
AHI.SubscribeKeyboard(keyboardId, true, Func("KeyEvent"))

#IfWinActive ahk_class TscShellContainerClass()
KeyEvent(code, state)
Edit: I also keep getting this error too:

Re: TapHoldManager - Long Press / Multi Tap / Multi Tap and Hold / Any number of Taps / Multi-Keyboard / Joystick button

Posted: 16 Feb 2022, 18:26
by SteveMylo
@BeerBread Hi, I don't use AHI or anything else like that, so that may be the cause of your troubles, but I write out THM taps in a 'newer' fashion for taps. if (isHold=0) & (taps=1) & (state){
Not sure if this will be any help for you at all, but its' Structured like this.

Code: Select all

#Include <TapHoldManager>
thm := new TapHoldManager()

thm.Add("x", Func("XFunction"))


;  ======== > any (OTHER) include files not related to THM you may have, has to go below the THM Funciton HERE <========
;~ #Include <Vector>
;~ #Include <FindText>
;~ #Include <ToolTipFM>
;~ #Include <PreventRepeating>
;=================================================================================

XFunction(isHold, taps, state){
if (isHold=0) & (taps=1) & (state){   ;  1tap
	SoundBeep 
	return
}

if (isHold=1) & (taps=2) & (state=0){   ;  2taps & hold, state=0 means it beeps only when 'x'  is released. 
										; state=1 means it beeps when pressed down.
	SoundBeep 
	SoundBeep
	return
}
}

Re: TapHoldManager - Long Press / Multi Tap / Multi Tap and Hold / Any number of Taps / Multi-Keyboard / Joystick button

Posted: 17 Feb 2022, 11:57
by BeerBread
SteveMylo wrote:
16 Feb 2022, 18:26
@BeerBread Hi, I don't use AHI or anything else like that, so that may be the cause of your troubles, but I write out THM taps in a 'newer' fashion for taps. if (isHold=0) & (taps=1) & (state){
Not sure if this will be any help for you at all, but its' Structured like this.

Code: Select all

#Include <TapHoldManager>
thm := new TapHoldManager()

thm.Add("x", Func("XFunction"))


;  ======== > any (OTHER) include files not related to THM you may have, has to go below the THM Funciton HERE <========
;~ #Include <Vector>
;~ #Include <FindText>
;~ #Include <ToolTipFM>
;~ #Include <PreventRepeating>
;=================================================================================

XFunction(isHold, taps, state){
if (isHold=0) & (taps=1) & (state){   ;  1tap
	SoundBeep 
	return
}

if (isHold=1) & (taps=2) & (state=0){   ;  2taps & hold, state=0 means it beeps only when 'x'  is released. 
										; state=1 means it beeps when pressed down.
	SoundBeep 
	SoundBeep
	return
}
}
Hey Steve, thanks for the response! I tried that format and no dice. I did rearrange the code on my header and I'm not getting error messages anymore, but the script doesn't do anything sadly.

Re: TapHoldManager - Long Press / Multi Tap / Multi Tap and Hold / Any number of Taps / Multi-Keyboard / Joystick button

Posted: 17 Feb 2022, 16:46
by SteveMylo
@BeerBread Ok good luck. I'm sure its' a AHI thing and all the others combined. Unfortunatley No one really responds anymore on here ha. I whish they did, THM is the perfect default tool for any hotkey, heck I even use it as a simple Keywait as it solves all issues.

Re: TapHoldManager - Long Press / Multi Tap / Multi Tap and Hold / Any number of Taps / Multi-Keyboard / Joystick button

Posted: 18 Feb 2022, 14:44
by BeerBread
SteveMylo wrote:
17 Feb 2022, 16:46
@BeerBread Ok good luck. I'm sure its' a AHI thing and all the others combined. Unfortunatley No one really responds anymore on here ha. I whish they did, THM is the perfect default tool for any hotkey, heck I even use it as a simple Keywait as it solves all issues.
Thanks! I think I figured it out! I might have to rewrite my whole script to accommodate THM. I keep getting a "Functions cannot contain functions" or, "hotkeys/hotstrings can't be together," errors. Ultimately, this is what a snippet of my code looks like:

Code: Select all

;return
#NoEnv  ; Recommended 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.

#SingleInstance force
#Persistent
#include <AutoHotInterception> ; ! ! ! Without this external library AHI Scripts won't work.
#include <TapHoldManager> ; ! ! ! Without this external library THM Scripts won't work.
#include <InterceptionTapHold> ; ! ! ! Without this AHI Scripts won't work.
#IfWinActive ahk_class TscShellContainerClass()
#UseHook ;For Remote Desktop to work.

AHI := new AutoHotInterception() ; Initializing Interception
keyboardId := AHI.GetKeyboardId(0x1A2C, 0x4094) ; ; Retrieving the ID of the keyboard inside the Windows
ITH1 := new InterceptionTapHold(AHI, keyboardId) ; Initializing Interception Tap Hold (ITH)
ITH1.Add("l", Func("LFunction"))
;thm.Add("L", Func("LFunction"))

;This function begins the process of intercepting each individual key and redirecting the thread accordingly to corresponding conditions inside of the callback function. Keys are empty if there is no specified "IF" condition for them.
AHI.SubscribeKeyboard(keyboardId, true, Func("KeyEvent"))


KeyEvent(code, state)

{
;===========Direct Bills========Q==========
{
if (state=1) & (code=16) ; This will tab through until you hit the Schedule Number 2000
	{
		Send,{1}
		Send, {tab 5}
		Send, {O}
		Sleep, 300
		Send, {tab 3}
		Sleep, 300
		Send, {2}{0}0}{0}
		Send, {tab}
	}
;
;===============Cash Receipts (Both Direct & Agency Bill===========L=======

;if (state=1) & (code=38) ;Experimental - One Tap is for Direct Bills, Two Taps for Agency Bills
LFunction(isHold, taps, state){
if (isHold=0) & (taps=1) & (state){   ;  1tap
		Send,{1} 
		Send, {tab 5}
		Send, {O}
		Sleep, 300
		Send, {tab 3}
		Sleep, 300
		Send, {2}{0}0}{0}
		Send,{tab}
		return
}

if (isHold=0) & (taps=2) & (state){
	Send,{1}
	Send, {tab 5}
	Send, {C}
	Sleep, 300
	Send, {tab}
	return
}
}

;
And then there's more code numbers from AHI. If they can't coexist, it's not a big deal, but it would be nice if that's the case :lol:

Edit: Just moving into the new code and I'm still getting "Functions cannot contain functions." Anyway to format this?

Code: Select all

;return
#NoEnv  ; Recommended 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.

#SingleInstance force
#Persistent
#include <AutoHotInterception> ; ! ! ! Without this external library AHI Scripts won't work.
#include <TapHoldManager> ; ! ! ! Without this external library THM Scripts won't work.
#include <InterceptionTapHold> ; ! ! ! Without this AHI Scripts won't work.
#IfWinActive ahk_class TscShellContainerClass()
#UseHook ;For Remote Desktop to work.

AHI := new AutoHotInterception() ; Initializing Interception
keyboardId := AHI.GetKeyboardId(0x1A2C, 0x4094) ; ; Retrieving the ID of the keyboard inside the Windows
ITH1 := new InterceptionTapHold(AHI, keyboardId) ; Initializing Interception Tap Hold (ITH)
ITH1.Add("Q", Func("QFunction"))
ITH1.Add("W", Func("WFunction"))


;This function begins the process of intercepting each individual key and redirecting the thread accordingly to corresponding conditions inside of the callback function. Keys are empty if there is no specified "IF" condition for them.
;AHI.SubscribeKeyboard(keyboardId, true, Func("KeyEvent"))


;KeyEvent(code, state)

{
;===============Cash Receipts (Both Direct & Agency Bill===========Q=======
;
QFunction(isHold, taps, state){
if (isHold=0) & (taps=1) & (state){ 
		Send,{1} 
		Send, {tab 5}
		Send, {O}
		Sleep, 300
		Send, {tab 3}
		Sleep, 300
		Send, {2}{0}0}{0}
		Send,{tab}
		return
	}

if (isHold=0) & (taps=2) & (state)
	{
	Send,{1}
	Send, {tab 5}
	Send, {C}
	Sleep, 300
	Send, {tab}
	return
	}
;
;=====================Paste Check# in Description========W=======
;
WFunction(isHold, taps, state){
if (isHold=0) & (taps=1) & (state)
	{ 
		Send,{tab 2}
		Sleep, 300
		Send,^v
		Send,{tab}
		return
	}
}
;====================
}

Re: TapHoldManager - Long Press / Multi Tap / Multi Tap and Hold / Any number of Taps / Multi-Keyboard / Joystick button

Posted: 18 Feb 2022, 16:08
by gwarble
missing a } before WFunction() definition?

and/or Send, {2}{0}0}{0} missing a { ?

Re: TapHoldManager - Long Press / Multi Tap / Multi Tap and Hold / Any number of Taps / Multi-Keyboard / Joystick button

Posted: 18 Feb 2022, 18:29
by SteveMylo
BeerBread wrote:
18 Feb 2022, 14:44
I keep getting a "Functions cannot contain functions
yup what he said above.
Missing 2 of curley brackets "}" Paste what I have below and see if it works.

Code: Select all

QFunction(isHold, taps, state){
if (isHold=0) & (taps=1) & (state){ 
		Send,{1} 
		Send, {tab 5}
		Send, {O}
		Sleep, 300
		Send, {tab 3}
		Sleep, 300
		Send, {2}{0}{0}{0}
		Send,{tab}
		return
	}

if (isHold=0) & (taps=2) & (state){
	Send,{1}
	Send, {tab 5}
	Send, {C}
	Sleep, 300
	Send, {tab}
	return
   }
}
;
;=====================Paste Check# in Description========W=======
;

WFunction(isHold, taps, state){
if (isHold=0) & (taps=1) & (state){

		Send,{tab 2}
		Sleep, 300
		Send,^v
		Send,{tab}
		return
	}
}
;=
===================

Re: TapHoldManager - Long Press / Multi Tap / Multi Tap and Hold / Any number of Taps / Multi-Keyboard / Joystick button

Posted: 19 Feb 2022, 11:02
by jkwaza
Weeks of trying to solve this. Please help!

This is the Interception Mode Subscription Example.
Whenever I run it says: "Unknown mouse button name 1", the "1" is whatever key I add to kb1.

Also when I un-comment to get a list of devices, it shows a blank box, which is puzzling as I can get AutoHotInterception working very well.

Code: Select all

#include Lib\AutoHotInterception.ahk
#include Lib\TapHoldManager.ahk
#include Lib\InterceptionTapHold.ahk

#Persistent	; Interception scripts may not declare hotkeys, so you may need this to stop it exiting
#SingleInstance force

; Add the VID / PID of the keyboard you wish to filter here
VID1 := 0x04D9, PID1 := 0xA0F8

kb1 := new InterceptionTapHold(VID1, PID1)	; TapTime / Prefix can now be set here
kb1.Add("1", Func("Kb1Func"))			; TapFunc / HoldFunc now always one function

; Un-Comment this to get a list of devices
;devices := kb1.GetKeyboardList()
;Clipboard := devices
;msgbox % devices

Kb1Func(isHold, taps, state){
	ToolTip % "KB 1 Key 1`n" (isHold ? "HOLD" : "TAP") "`nTaps: " taps "`nState: " state
}

Kb2Func(isHold, taps, state){
	ToolTip % "KB 2 Key 1`n" (isHold ? "HOLD" : "TAP") "`nTaps: " taps "`nState: " state
}

I have also tried this too in Interception Tap Hold Demo, which doesn't subscribe/block keyboard nor assign a key.
I've come back to this so many times to give my external numpad TapHold functionality, but just having no luck. It looks like the clues are in TapHoldManager.ahk and InterceptionTapHold.ahk, but I cannot fully wrap my head around those.

Has anyone else experienced this?
What am I doing wrong?

Code: Select all

#SingleInstance force
#include <AutoHotInterception>
#include <InterceptionTapHold>
#include <TapHoldManager>

AHI := new AutoHotInterception()
keyboard1Id := AHI.GetKeyboardId(0x04D9, 0xA0F8) ;keypad
ITH1 := new InterceptionTapHold(AHI, keyboard1Id)
;ITH1 := new TapHoldManager()
ITH1.Add("1", Func("Func1"))
ITH1.Add("2", Func("Func2"))
return

Func1(isHold, taps, state){
    ToolTip % "KB 1 Key 1`n" (isHold ? "HOLD" : "TAP") "`nTaps: " taps "`nState: " state
}

Func2(isHold, taps, state){
    ToolTip % "KB 1 Key 2`n" (isHold ? "HOLD" : "TAP") "`nTaps: " taps "`nState: " state
}

Re: TapHoldManager - Long Press / Multi Tap / Multi Tap and Hold / Any number of Taps / Multi-Keyboard / Joystick button

Posted: 19 Feb 2022, 12:06
by BeerBread
@gwarble
@SteveMylo

Holy crap, they worked!!! Thank you so much!! Those damn brackets threw me off! I definitely need some sleep :D

Re: TapHoldManager - Long Press / Multi Tap / Multi Tap and Hold / Any number of Taps / Multi-Keyboard / Joystick button

Posted: 20 Feb 2022, 14:52
by gwarble
@BeerBread
no problem, that error to me always means "since you know that functions can't contain functions, its probably a missing } or { or a copy/paste error"