【问题标题】:AHK - Modify #Options with HotkeysAHK - 使用热键修改#Options
【发布时间】:2018-10-10 13:39:33
【问题描述】:


是否可以将 Hotsrting 设置与热键结合使用?
([i]当然没有复制所有的热字串并且没有在热字串中添加额外的行[/i])
我可以想象方法,但只能复制所有内容。

原因:
我想使用普通空间以某种方式触发热环,最后添加空间,
但如果我想将它用作“:o:”,我想使用 Alt+Space
(实际上,如果知道如何使用热键来修改某些#Options,这将是非常好的。)

[u]Something like this: [/u]<br>
#"if Alt is pressed"
{
#Hotkey o 
}
::hlo::Hello!
::wtv::Whatever


或者,它可以在结束后添加一个 BS,例如:

~!space::send,{bs}   ;(this does not work together with the hotsrting ofcourse)

而不是这样的:

::hlo::
{
if alt is pressed...else ...
}

编辑:
所以我们在 Discord AHK 论坛上讨论了很长时间。
到目前为止,我的问题的不同方面的答案:
- 您不能直接修改任何#Options
- 但可以通过特定功能即时修改热键/热环等。
- 在 Hotstrings 的情况下,一个非常新的功能也是使用 :x:abc::,它允许使用表达式 -> 并且我们可以调用一个使用 GlobalVariables 的函数 -> 通过这些变量可以进行设置运行前动态调整。
- 我对特定问题的最终解决方案非常不同。与其使用内置选项,不如使用一个讨厌的解决方法来获得更好的运气:

#inputlevel 1
!space:: 
{
        SendInput,{space}
        sleep 0
        SendInput,{bs}
return
}
#inputlevel 0
::asd::by the way

- 还粘贴了@CliveGalway(又名 EvilC?)的代码之一,通过论坛帮助了我。在这种特殊情况下我无法使用它的原因是,如果使用 :x:,热字符串会失去其自动 CaseSensitivity - 我不希望那样...否则优秀的脚本:

#SingleInstance force
EndCharOn := 0
SetCapsLockState, Off

hotStrings := [{hs: "btw", rep: "By the Way"}
                ,{hs: "tat", rep: "This and That"}]

for i, h in hotStrings {
    HotString(":X:" h.hs, Func("SendHotString").Bind(h.rep))
}

CapsLock::
    EndCharOn := !EndCharOn
    SetCapsState()
    return

SetCapsState(){
    global EndCharOn
    SetCapsLockState, % (EndCharOn ? "On" : "Off")
}

SendHotString(Text){
    global EndCharOn
    SendRaw, % Text (EndCharOn ? A_EndChar : "")
    EndCharOn := 0
    SetCapsState()
}

^Esc::
    ExitApp

【问题讨论】:

    标签: autohotkey


    【解决方案1】:

    不太清楚你在说什么。我认为你想要#if

    #if GetKeyState("Alt") ; Only enable these hotstrings if Alt is held
    ::hlo::Hello!
    ::wtv::Whatever
    #if
    

    【讨论】:

    • 嗨,你是论坛的 EvilC,对吧? ——我已经试着总结一下,我们上面的相关讨论。
    • 我还是要为你的这条评论加分,作为对你的努力的总体感谢。
    猜你喜欢
    • 2018-01-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-10-21
    • 2014-05-25
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多