Now I'm trying to create a function from it, but it doesn't work. As I understand, that's because AHK doesn't allow variables as hotkeys?
Code: Select all
/*
; 1st example
f1:: return
^f1::
hotkey, f1, off
sendInput, {f1}
hotkey, f1, on
return
*/
; 2nd example: function
remapHotkey(hotkey) {
%hotkey%:: return
^%hotkey%::
hotkey, %hotkey%, off
sendInput, {%hotkey%}
hotkey, %hotkey%, on
return
}
remapHotkey("f1")