如何使用autohotkey在Windows 10中模拟超级密钥

我正在将我的mac工作流迁移到 Windows.我不能没有的一件事是超级键,它是Ctrl Option Shift Cmd的组合.我使用Karabiner应用程序将Capslock重新映射到此Hyper键.我听说Autohotkey是Windows的Karabiner替代品.你能帮助我在Windows中模仿这个功能吗? 我理想的

我正在将我的mac工作流迁移到
Windows.我不能没有的一件事是超级键,它是Ctrl Option Shift Cmd的组合.我使用Karabiner应用程序将Capslock重新映射到此Hyper键.我听说Autohotkey是Windows的Karabiner替代品.你能帮助我在Windows中模仿这个功能吗?

我理想的结果是:

>完全取消激活Capslock,因为我很少使用它
> Toggle Capslock将执行ESC键
>按住Capslock将执行Ctrl Alt Shift Windows.例如,Capslock C将是Ctrl Alt Shift Windows C.

提前谢谢了!

以下是我用ahk脚本的尝试,但它根本不起作用:(

;-----------------------------------------
; hyper key for windows
;=========================================

; --------------------------------------------------------------
; notes
; --------------------------------------------------------------
; ! = alt
; ^ = ctrl
; + = shift
; # = lwin|rwin
;
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
#UseHook
#InstallKeybdHook
#SingleInstance force

SendMode Input

;; deactivate capslock completely
SetCapslockState,AlwaysOff

;; remap capslock to hyper
Capslock::
SendInput {Blind}{Ctrl Down}{Alt Down}{Shift Down}{LWin Down}
return

Capslock up::
SendInput {Blind}{Ctrl Up}{Alt Up}{Shift Up}{LWin Up}
return

;; vim navigation with hyper
^!+#h:: SendInput {Blind}{Left}
^!+#h up:: SendInput {Blind}{Left Up}
^!+#l:: SendInput {Blind}{Right}
^!+#k:: SendInput {Blind}{Up}
^!+#j:: SendInput {Blind}{Down}

;; popular hotkeys with hyper
^!+#c::^c
^!+#v::^v

解决方法

感谢任何想要帮助我的人,我自己想出了这个问题,并希望分享它以防万一有人遇到这个问题.

#NoEnv ; recommended for performance and compatibility with future autohotkey releases.
#UseHook
#InstallKeybdHook
#SingleInstance force

SendMode Input

;; deactivate capslock completely
SetCapslockState,AlwaysOff

;; remap capslock to hyper
;; if capslock is toggled,remap it to esc

;; note: must use tidle prefix to fire hotkey once it is pressed
;; not until the hotkey is released
~Capslock::
    ;; must use downtemp to emulate hyper key,you cannot use down in this case 
    ;; according to https://autohotkey.com/docs/commands/Send.htm,downtemp is as same as down except for ctrl/alt/shift/win keys
    ;; in those cases,downtemp tells subsequent sends that the key is not permanently down,and may be 
    ;; released whenever a keystroke calls for it.
    ;; for example,Send {Ctrl Downtemp} followed later by Send {Left} would produce a normal {Left}
    ;; keystroke,not a Ctrl{Left} keystroke
    Send {Ctrl DownTemp}{Shift DownTemp}{Alt DownTemp}{LWin DownTemp}
    KeyWait,Capslock
    Send {Ctrl Up}{Shift Up}{Alt Up}{LWin Up}
    if (A_PriorKey = "Capslock") {
        Send {Esc}
    }
return

;; vim navigation with hyper
~Capslock & h:: Send {Left}
~Capslock & l:: Send {Right}
~Capslock & k:: Send {Up}
~Capslock & j:: Send {Down}

;; popular hotkeys with hyper
~Capslock & c:: Send ^{c}
~Capslock & v:: Send ^{v}

关于作者: dawei

【声明】:石家庄站长网内容转载自互联网,其相关言论仅代表作者个人观点绝非权威,不代表本站立场。如您发现内容存在版权问题,请提交相关链接至邮箱:bqsm@foxmail.com,我们将及时予以处理。

为您推荐