evilC / TapHoldManager

An AHK library for Long Press / Multi tap / Multi tap and hold
MIT License
124 stars 13 forks source link

Multi tap + Hold sending another key #3

Open axsddlr opened 5 years ago

axsddlr commented 5 years ago

trying to set a hold to a keybind to send F24 from F15 (using macropad) it send the macro combo but then sends "Alt + Shift" right after in AHK not sure why, code below:

#include D:\Docs\AutoHotKey\Libs\TapHoldManager.ahk

#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.

DetectHiddenWindows, On

#SingleInstance force

thm := new TapHoldManager() ; TapTime / Prefix can now be set here
thm.Add("F15", Func("OBScenes"), -1, 300, -1, "$*")

OBScenes(isHold, taps, state){
WinActivate, OBS ahk_exe obs64.exe
    if (isHold){
        ; Holds
        if (state){
            Send  {LShift down}{F24 down}
        } else {
            Send  {LShift up}{F24 up}
        }
    } else {
        ; Taps
        if (taps == 1){
             Send  {LCtrl down}{LShift down}{F24 down}
              Sleep, 10
             Send  {LCtrl up}{LShift up}{F24 up} ;Intro Scene
        } else if (taps == 2){
              Sleep, 10
             Send !+{F24}  ;AFK Scene
        }
    }
}
evilC commented 5 years ago

I don't see any obvious reason why. Does the same issue repro if you use a normal key as the trigger key? (eg F12) Suspect issue could be to do with using F keys above F12

axsddlr commented 5 years ago

confirmed f1-f12 seems to act the same way, only taps seems to work