如何使用 AHK 发送正斜杠
How to send a forward slash using AHK
最简单的解释使用代码:
RAlt & a::{
RAlt & s::[
RAlt & d::]
RAlt & f::}
RAlt & r::/ ; Only one not working here. Pressing RAlt+r does nothing...
RAlt & t::\
除了正斜杠的替换外,所有替换都按预期工作。
我已经尝试过以下方法:
- 将
/
绑定到不同的热键,例如 RAlt & t
-> 不起作用
- 将其他内容绑定到
RAlt & r
,例如}
-> 不工作
--> 与热键RAlt & r
无关,与替换字符有关/
试试 SendRaw:与 Send 类似,只是 Keys 中的所有字符都按字面意思解释和发送。
RAlt & a::SendRaw, {
RAlt & s::SendRaw, [
RAlt & d::SendRaw, ]
RAlt & f::SendRaw, }
RAlt & r::SendRaw, /
RAlt & t::SendRaw, \
它不起作用,因为 remapping syntax doesn't release the RAlt key due to internally using the blind 发送模式。
所以,它会发送生成 /
键所需的输入(无论它在您的键盘布局上是什么,对我来说都是 AltGr + +),但最重要的是,RAlt 键也将被按住。
在我的键盘布局上,这导致 RAlt + AltGr + +, 确实有效。所以我猜你不在我的键盘布局上,哈哈。
因此,为了在输入过程中不按住 RAlt,您需要释放它。
最简单的方法是在没有盲模式的情况下使用 send commands 中的任何一个。它会自动为您完成释放。
我当然会推荐 SendInput
发送模式,因为它是最可靠和最快的。
由于您的两个键({
和 }
)在发送命令中具有特殊含义,您可能想要 escape them ({{}
and {}}
), or use the text mode. (And definitely not the raw mode,因为它实际上会让您出局发送输入模式)
另外,按照文档中的建议,不要使用 custom combination hotkey syntax if you can achieve your hotkey with the modifiers。
在你的情况下,你确实可以使用修饰符:
>!r::
如果您的键盘布局有 RAlt 键
<^>!r::
如果您的键盘布局有 AltGr 键
这是您完成的脚本:
我选择转义而不是文本模式,并假设存在 RAlt 键。
>!a::SendInput, {{}
>!s::SendInput, [
>!d::SendInput, ]
>!f::SendInput, {}}
>!r::SendInput, /
>!t::SendInput, \
最简单的解释使用代码:
RAlt & a::{
RAlt & s::[
RAlt & d::]
RAlt & f::}
RAlt & r::/ ; Only one not working here. Pressing RAlt+r does nothing...
RAlt & t::\
除了正斜杠的替换外,所有替换都按预期工作。
我已经尝试过以下方法:
- 将
/
绑定到不同的热键,例如RAlt & t
-> 不起作用 - 将其他内容绑定到
RAlt & r
,例如}
-> 不工作
--> 与热键RAlt & r
无关,与替换字符有关/
试试 SendRaw:与 Send 类似,只是 Keys 中的所有字符都按字面意思解释和发送。
RAlt & a::SendRaw, {
RAlt & s::SendRaw, [
RAlt & d::SendRaw, ]
RAlt & f::SendRaw, }
RAlt & r::SendRaw, /
RAlt & t::SendRaw, \
它不起作用,因为 remapping syntax doesn't release the RAlt key due to internally using the blind 发送模式。
所以,它会发送生成 /
键所需的输入(无论它在您的键盘布局上是什么,对我来说都是 AltGr + +),但最重要的是,RAlt 键也将被按住。
在我的键盘布局上,这导致 RAlt + AltGr + +, 确实有效。所以我猜你不在我的键盘布局上,哈哈。
因此,为了在输入过程中不按住 RAlt,您需要释放它。
最简单的方法是在没有盲模式的情况下使用 send commands 中的任何一个。它会自动为您完成释放。
我当然会推荐 SendInput
发送模式,因为它是最可靠和最快的。
由于您的两个键({
和 }
)在发送命令中具有特殊含义,您可能想要 escape them ({{}
and {}}
), or use the text mode. (And definitely not the raw mode,因为它实际上会让您出局发送输入模式)
另外,按照文档中的建议,不要使用 custom combination hotkey syntax if you can achieve your hotkey with the modifiers。
在你的情况下,你确实可以使用修饰符:
>!r::
如果您的键盘布局有 RAlt 键<^>!r::
如果您的键盘布局有 AltGr 键
这是您完成的脚本:
我选择转义而不是文本模式,并假设存在 RAlt 键。
>!a::SendInput, {{}
>!s::SendInput, [
>!d::SendInput, ]
>!f::SendInput, {}}
>!r::SendInput, /
>!t::SendInput, \