AutoHotkey读取最后一行

时间:2017-07-13 16:53:02

标签: autohotkey

我正在尝试创建一个运行点击宏的脚本,该宏一直持续到文本文件中的最后一行显示特定内容。

没有太多经验

NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. ; #Warn ; Enable warnings to assist with detecting common errors. SendMode, Event ; Recommended for new scripts due to its superior speed and reliability. SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. SetMouseDelay, 22

p::

Loop, {

Send, ^{Click 758, 243} Send, ^{Click 903, 545} Send, ^{Click 758, 305} Send, ^{Click 903, 545} Send, ^{Click 793, 329} Send, ^{Click 903, 545} Send, ^{Click 758, 454} Send, ^{Click 903, 545} Send, ^{Click 1036, 412} Send, ^{Click 1711, 719} Send, ^{Click 1028, 259} Send, +{Click 903, 545} Loop read, F:\Cooking\bread\Flour_amount.txt { Loop, parse, A_LoopReadLine, last_line := A_LoopReadLine, if InString, A_LoopReadLine, Too much Flour, Break Else continue }

}

1 个答案:

答案 0 :(得分:0)

上面的代码将无限循环(单击鼠标然后读取文件)。如果您希望单击文件的每一行,并在读取特定行时结束,则只有文件读取循环并将点击放在其中。

p::

Loop read, F:\Cooking\bread\Flour_amount.txt 
{ 
   ; Do something for each line in the file


   if InString, A_LoopReadLine, Too much Flour, 
      Break 
}