简单的AHK脚本不起作用
Simple AHK script not working
我在AHK上读了很多页面,但没有找到任何解释如何制作一个脚本的页面,当它被以下内容键入时,我可以替换"for":
for(int i=0;i<CONDITION;i++)
{
}
我希望它将光标焦点设置在括号内,以便立即开始编写循环代码。
以下是我到目前为止的想法:
::for::for(int i=0;i<CONDITION;i++),
{,
,
}
应该将"for"替换为帖子顶部的代码,但会出现以下错误:
Error at line 2.
linetext: ,,
Error: this line does not contain recognised action.
The program will exit.
执行多行的热键(或hotstring)必须在热键(或hotstring)下列出其第一行。https://autohotkey.com/docs/FAQ.htm#autoexec
逗号、分号和其他字符,如{}^!+#在AHK中具有特殊含义,需要转义,以便与正常情况下进行不同的解释。https://autohotkey.com/docs/commands/_EscapeChar.htm
::for::for(int i=0`;i<CONDITION`;i`{+`}`{+`})`n`{`{`}`n`n`{`}`}{Up}
发送此类文本的最简单方法是:
; #If WinActive("ahk_class Notepad")
::for::
ClipSaved := ClipboardAll ; save clipboard
clipboard := "" ; empty clipboard
clipboard = ; send this text to the clipboard:
(
for(int i=0;i<CONDITION;i++)
{
}
)
ClipWait, 1 ; wait for the clipboard to contain data
Send, ^v
Send, {Up}
clipboard := ClipSaved ; restore original clipboard
return
; #If
这种方法也相当简单,它在Scite和Notepad++中运行良好,可以自动处理选项卡:
::for::
SendRaw,
(
For(int i=0;i<CONDITION;i++)
{
}
)
Send, {Up}{End}
return
相关文章:
- 我的神经网络不起作用 [XOR 问题]
- 在C++程序中输入的文本文件将不起作用,除非文本被复制和粘贴
- C++映射:具有自定义类的运算符[]不起作用(总是返回0)
- C++为什么尽管我调用了void函数,它却不起作用
- 为什么在保护模式下继承升级不起作用
- 循环在计数器中不起作用
- 在其他文件中创建类时在 c++ 项目中不起作用
- Visual studio代码重构似乎不起作用(例如,重命名符号-f2)
- 为什么二进制搜索在我的测试中不起作用
- 我的代码中有错误吗?使用BGI图形的C++代码对我不起作用
- 为什么 const std::p air<K,V>& 在 std::map 上基于范围的 for 循环不起作用?
- 带有指定长度字符* 参数的 std::regex_search 在 VS2017 中不起作用?
- Bjarne Stroustrup Book - std_lib_facilities.h - 不起作用(未知类型名称)
- 为什么简单的算术减法在"if"条件下不起作用?
- 为什么Stroustup书中的has_f不起作用
- 为什么 C++ 中的 shell 脚本代码不起作用?
- 使用curl在cgi脚本中编译的c++不起作用
- 简单的AHK脚本不起作用
- 使用编译的lua脚本的Cocos2d-x在Android上不起作用
- 为什么这个蚂蚁脚本不起作用?