TaranVH / 2nd-keyboard

ALL of Taran's scripts - not just for the 2nd keyboard.
https://www.youtube.com/watch?v=O6ERELse_QY
1.65k stars 538 forks source link

Technique: dual wrap - modifiers work with every key and all keys work well (except pause break, good luck with that one) #133

Open Slugre opened 3 years ago

Slugre commented 3 years ago

This is a more of a useful technique/suggestion than an Issue, but it does fix an issue, and there's no technique/suggestion input format on github so i posted it here? It's super useful and it just feels bad not putting it out there for others. I don't know where else to post this, it is very specifically useful to macro king's audience and perhaps no one else.

I've had issues with modifiers (shift and ctrl and whatnot) not working with every key on the keyboard, and there's the known issue with some keys being problematic in autohotkey. Here I provide a very simple and (as far as I can see) bulletproof technique to solve both of those problems, especially if you're only using 1 physical keyboard for all your macros.

Normal keys like letters A-Z always work flawlessly. So what you do is instead of wrapping the whole keyboard in F23, and using limited SC0xy keys to recode things like scroll lock and whatnot, just split the keyboard into two virtual keyboards in intercept. Use F23 wrap on keys that work fine, and for others like numlock instead of rewrapping it as numlock rewrap it as letter J (that would follow the order in the picture, use any other if you wish so) in F22 (so not F23). Then rewrap scroll lock as letter L in F22 wrap and so on. After that in autohotkey just have two separate groups of letters, one group inside "#if (getKeyState("F23", "P"))", and the other group inside "#if (getKeyState("F22", "P"))"". If you run out of second group of normal keys for all the macros you need, include another virtual, F24 wrapped keyboard. Works amazing if you only intend to use a single macro keyboard. For multiple physical keyboards, you will run out of wrapping keys (F22, F23, F24..) much faster.

Here's a picture to visualise my idea of having 2 virtual keyboards on one real keyboard: dualwrap *accidentally left a letter over pause break in the picture **some normal keys to the right of letters P, L and M are rewrapped because in my languange they are some crazy symbols that autohotkey cannot work with.

Here is the code for keyremap.ini for buttons q and capslock rewrapped as q on 2 virtual keyboards: ;wrapping q in F23 device=HID\VID_046D&PID_C31C&REV_6400&MI_00 trigger=10,0,0 combo=6E,0,0|10,0,0|10,0,1|6E,0,1 ;wrapping caps lock as q in F22 device=HID\VID_046D&PID_C31C&REV_6400&MI_00 trigger=3a,0,0 combo=6D,0,0|10,0,0|10,0,1|6D,0,1

Here is the code for autohotkey script for buttons q and capslock with and without shift modifiers:

if (getKeyState("F23", "P"))

q::msgbox, This is button q on the keyboard +q::msgbox, This is shift + button q on the keyboard

if (getKeyState("F22", "P"))

q::msgbox, This is button "caps lock" on the keyboard +q::msgbox, This is shift + button "caps lock" on the keyboard

if

I have watched all the tutorials some time ago and I don't remember this being mentioned, if it was and I forgot, I apologize.