Autohotkey 仅当在行首键入热字符串时才替换文本

Autohotkey 仅当在行首键入热字符串时才替换文本,autohotkey,Autohotkey,这是我试过的 :*:func:: { clipboard = startOfLine Send +{LEFT}^c clipwait if(clipboard == "startOfLine") send,function xxx() {{}`n`n`n{}}{UP 2}{BACK}{TAB} } return 但剪贴板永远不会被替换 有没有更好的方法来判断你是否在一行的开头 注意:这是用于在IDE中键入的,请尝试: Send {Home}+{End}^c

这是我试过的

:*:func::
{
   clipboard = startOfLine
   Send +{LEFT}^c
   clipwait
   if(clipboard == "startOfLine")
       send,function xxx() {{}`n`n`n{}}{UP 2}{BACK}{TAB}
}
return
但剪贴板永远不会被替换

有没有更好的方法来判断你是否在一行的开头

注意:这是用于在IDE中键入的,请尝试:

Send {Home}+{End}^c ;copies current line
If Clipboard =  ;  checks to see if clipboard is empty
    send,function xxx() {{}`n`n`n{}}{UP 2}{BACK}{TAB}

这可能有一个答案直到现在我还没有看到这个答案-放弃这个技术,但至少我学会了一种复制当前行的技术。谢谢