A few issues here:
First, I think suppressMods
is somehow broken, and I guess when you activate leftShift from another macro, then it does not get suppressed here.
You could try working around that with releaseKey leftShift
, i.e. use longer sequences like:
ifShift {
releaseKey leftShift
tapKey 3
break
}
I’m not completely sure if that will work, but give it a try.
Second,
You can never reach the ifShift ifHold
in line 3 because as long as Shift is held line 2 already triggers and final
makes execution stop after tapping key (=sending scancode) 3.
Third,
I would check ifHold
once and only once at the beginning as this uses the time machine and will hold the execution of your macro until it is resolved. I am not sure what happens if you check it again in the same macro. You can use blocks of code in braces {
… }
for further separation depending on Shift/NotShift. Something like this:
ifHold {
ifShift final doSomething // shift & hold
final doSomethingElse // hold (but without shift)
}
ifShift final doSomethingHere // only shift (no hold)
doSomethingPlain // no shift, no hold, just a simple tap
If you need to avoid the final
s because you want more complex things, then use more braces:
ifHold {
ifShift {
doAThing
doSomething // shift & hold
break
}
doAnotherThing
doSomethingElse // hold (but without shift)
break
}
ifShift {
doAThingHere
doSomethingHere // only shift (no hold)
break
}
doSomethingPlain // no shift, no hold, just a simple tap
BTW, I avoid else
in code with braces, because it can go wrong. The else
only checks the result of any if
… that was executed before, and depending on which path you took through the nested if
s, it can give you unexpected results.
For another different and totally ugly approach, use goTo
:
ifHold {
ifShift goTo shiftAndHold
goTo holdWithoutShift
}
ifShift goTo shiftWithoutHold
doSomethingPlain
goTo theEnd
shiftAndHold:
doAThing
doSomething
goto theEnd
holdWithoutShift:
doAnotherThing
doSomethingElse
goTo theEnd
shiftWithoutHold:
doAThingHere
doSomethingHere // only shift (no hold)
theEnd: