FileReadLine系列命令

时间:2015-10-08 23:17:47

标签: autohotkey

在文件中搜索某些代码行。我的第一行脚本:

FileReadLine, OutputVar, C:\Files\prog.txt, 1
If (OutputVar = "FileRead, OutputVar, C:\Files\prog1.txt")
    MsgBox Code line found
else
    MsgBox Code line not found

如何在某些区域搜索此方法?行数从50到250,205到551等

1 个答案:

答案 0 :(得分:0)

使用文件解析循环:http://ahkscript.org/docs/commands/LoopReadFile.htm

Loop, read, C:\Files\prog.txt
{
    If (A_LoopReadLine = "FileRead, OutputVar, C:\Files\prog1.txt") {
        MsgBox, An interesting code line was found.
    } Else If (A_LoopReadLine = "blablabla") {
        MsgBox, An interesting code line was found.
    } Else If (A_LoopReadLine = "some other text line") {
        MsgBox, An interesting code line was found.
    ;} Else {
    ;    MsgBox, Nothing important was found
    ;}

}