For context, in Windows, you can press Alt+Tab and hold Alt to close many windows and applications by pressing Delete.
How can I create a macro on my UHK so that pressing Alt and then Tab, and continuing to hold Alt, changes the function of the D key to Delete? The D key should revert to its normal function when Alt is released.
I want to avoid creating an Alt layer that maps D to delete because A) there is no quick way to copy the base layer mapping to another layer (you can only duplicate a keymap); B) I want to preserve the original Alt+D for other applications (meaning I don’t want Alt+D to become Alt+Delete all the time).
Thanks! I’ve tried loading the reference doc into GPT-4 to help me write such a script, but it failed. It would be neat if there was a fine-tuned model specific to the UHK smart macro language one day!
Just released Agent 4.1.0, which includes many improvements. It also bundles the newly released firmware 11.1.0, which contains the fix. Current Agent installations should auto-update themselves and the firmware.
Thanks, I confirmed that d works in place of 81. With that, I was able to get help with GPT4-Turbo to refine the query to change my JKLI cluster to temporarily map to arrow keys. What a boost in ergonomics when I constantly alt-tab between a bunch of screens and delete. Here’s an update version:
pressKey iLA
ifShortcut noConsume tab {
// Temporarily rebind keys to new actions
set keymapAction.base.d keystroke delete
set keymapAction.base.j keystroke left
set keymapAction.base.k keystroke down
set keymapAction.base.l keystroke right
set keymapAction.base.i keystroke up
}
delayUntilRelease
// Restore keys to their original actions
set keymapAction.base.d keystroke d
set keymapAction.base.j keystroke j
set keymapAction.base.k keystroke k
set keymapAction.base.l keystroke l
set keymapAction.base.i keystroke i
releaseKey LA
It may not be perfect, but providing the user guide and reference along with a few examples helps GPT4 (Turbo edition, I believe, which has a longer context window) answer some basic queries. In my case, I was not sure how to execute multiple commands (rebind more than one key) and it accurately predicted the refined script. I think this sort of tool would help a lot of folks who are not so savvy with UHK smart macro programming language get more value. GPT4-Turbo also helped me build some other scripts or explain existing scripts so I better understand the syntax.