首页 > 解决方案 > Autohotkey 不总是发送密钥?(这里发生了什么)

问题描述

基本上我不明白发生了什么,任何澄清都会有所帮助

我正在尝试在我的程序中设置热键“ _ ”和“alt_ 。所以我做了一个自动热键脚本,用“_”替换“/”,用“alt _”替换其他按键,但它似乎并不总是在我的程序中工作?(除非我向命令发送垃圾邮件)

我的脚本:

/::
Send _ ;if I keep clicking "/" I always get the desired effect
return

但是当我打开我的程序并按“/”时,它不会启动指定的场景,除非我做这样的事情(但是它总是用文本中的 _ 替换“/”。

/::
Send_ ; This code works fine, I don't need to keep clicking "/" it works the first time but the codes awful
Send_
Send_
Send_
Send_
return

当我使用上面的代码时,streamlabs OBS 程序每次都会选择它并切换到适当的场景。但是当我只使用一个时Send _,它有时会立即起作用,有时我需要多次按下它。

我的完整代码(看起来工作正常)如下:

+/:: ; This is the hotkey I press "Shift /" to start the script
toggler := !toggler ; this changes a boolean every time the script is run
if (toggler) { ; Every odd run this happens (hides scene)
    Send +-
    Send +-
    Send +-
    Send +- ;; I feel like all these lines are redundant
    Send +-
    Send +-
    Send +-
    Send +-
    Send +-
    Send +-         
} else { ; every even run this happens (shows scene)
    Send !+-
    Send !+-
    Send !+-
    Send !+- ;; again idk why I need all these lines instead of just 1
    Send !+-
    Send !+-
    Send !+-
    Send !+-
    Send !+-
    Send !+-
}
return

基本上streamlab obs不允许您使用相同的热键打开/关闭场景,所以这就是我所做的,但我无法忍受我的解决方案:(

标签: autohotkeyobs

解决方案


推荐阅读