【问题标题】:Auto Hot Keys with coding text带有编码文本的自动热键
【发布时间】:2019-05-26 16:17:23
【问题描述】:

我想做一个自动热键脚本来粘贴:

{ get; set; }

对于 C#

这是可能的还是它不知道如何处理空格,{,;?

我尝试了以下方法,但它不起作用:

    ^NumPad3::
    SendInput, { get; set; }
    return

【问题讨论】:

  • Ctrl-C,Ctrl-V。 { 得到;放; }{ 得到;放; }{ 得到;放; }{ 得到;放; }{ 得到;放; }{ 得到;放; }{ 得到;放; }{ 得到;放; }{ 得到;放; }{ 得到;放; }{ 得到;放; }{ 得到;放; }
  • 你需要像这样在自动热键中转义花键:{{} 对应 {{}} 对应 }。分号开始注释行,除非您像 `; 一样将它们转义

标签: c# autohotkey


【解决方案1】:

逗号、分号和其他字符(例如 {}^!+#)在 AHK 中具有特殊含义,需要进行转义才能得到与通常不同的解释。

F1:: SendInput, {{} get`; set`; {}}

https://autohotkey.com/docs/commands/_EscapeChar.htm#Escape_Sequences

发送此类文本的最简单方法是

F2::
Send {Raw}  
(
{ get; set; }
)
return

F3::
Send {Blind}{Text} ; [v1.1.27+] 
(
{ get; set; }
)
return

https://autohotkey.com/docs/commands/Send.htm

【讨论】:

  • 感谢 user3419297!这很好用: F1:: SendInput, {{} get; set; {}}(我必须确保我在正确的部分进行操作,其中允许获取;设置;等等!)
猜你喜欢
  • 2019-02-06
  • 2013-03-20
  • 2012-11-16
  • 2021-02-19
  • 1970-01-01
  • 2011-02-15
  • 1970-01-01
  • 1970-01-01
  • 2022-11-27
相关资源
最近更新 更多