加入收藏 | 设为首页 | 会员中心 | 我要投稿 威海站长网 (https://www.0631zz.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 服务器 > 系统 > 正文

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

发布时间:2021-03-07 01:46:07 所属栏目:系统 来源:网络整理
导读:我正在将我的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}

(编辑:威海站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    热点阅读