Help with Tap Hold Manager library by evilC please

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
hellen_dorandt89
Posts: 25
Joined: 05 Jan 2022, 08:25

Help with Tap Hold Manager library by evilC please

Post by hellen_dorandt89 » 07 Dec 2022, 19:51

I have been experimenting with Tap hold manager library with some decent results. Currently i am trying to make a key trigger THM code ONLY when another key is held.

Using the example provided by THM creator HERE Its the second last answer in the thread.
I created something like this:

Code: Select all

#singleinstance, force
#NoEnv
#Persistent
#include <TapHoldManager>

  
  

hotkey, if, GetKeyState("F7", "P")
THMTEST:= new TapHoldManager( 200, 400, 2)
    THMTEST.add("s", Func("Mykey"))
    Mykey(isHold, taps, state)
     {
        if (taps == 1)
        {
            if (isHold == 0)
            {
               Tooltip, S pressed while F7 is down
            }
            else
            {
              if (state)
                            {
                            }

                  ; else

                  ;           {
                  ;           }
            }
        }
     }
But whenver I trie to run the code I get this error message :
Error Parameter 3 must be blank in this case
>[7]hotkey, if, GetKeyState("F7", "P")
I have been trying to get this to work some time and I am at a loss.
The person evilC proposed this solution to never confirmed if it worked for him or not.

Any help would be wellcome!

User avatar
mikeyww
Posts: 26951
Joined: 09 Sep 2014, 18:38

Re: Help with Tap Hold Manager library by evilC please

Post by mikeyww » 07 Dec 2022, 20:58

Can do like:

Code: Select all

#SingleInstance Force
Hotkey, x, Y, On
Return

Y:
Send z
Return

#If GetKeyState("F7", "P")
Explained: Hotkey
If "Hotkey If" is never used by a script, the bottommost use of any #If or #IfWin directive (if any) will be in effect for the Hotkey command.
Or:

Code: Select all

#SingleInstance Force
fn := Func("GetKeyState").Bind("F7", "P") 
Hotkey, If, % fn
Hotkey, x, Y, On
Return

Y:
Send z
Return

Post Reply

Return to “Ask for Help (v1)”