无法在自动热键中转义字符

Cannot escape char in autohotkeys

我想用 function(){console.log(arguments)} 替换 funcarg 它永远不会工作它总是用 function()

替换 funcarg

这是我的代码:

::funcarg::function(){console.log(arguments)}

我读了这篇文章,并尝试了许多不同的方法

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

::funcarg::function()\{console.log(arguments)}
::funcarg::function()%{console.log(arguments)}
::funcarg::function()'{console.log(arguments)}
::funcarg::function()`{console.log(arguments)}

将它们括在大括号 {{}{}}

::funcarg::function(){{}console.log(arguments){}}

AHK 将热字串替换为热键 + 发送命令,用大括号将其标记为要发送的特殊键。

这里有几个替代@Schneyer 方法的方法。

HotString 原始模式:

:R:funcarg::function(){console.log(arguments)}

使用 SendInput 和原始模式:

::funcarg::
var := "function(){console.log(arguments)}"
SendInput % "{Raw}" var
return

剪贴板/发送方法:

::funcarg::
clipboard := "function(){console.log(arguments)}"
sendInput, {ctrl down}{v}{ctrl up}
return