读取txt 每行 Loop, read, C:\Database Export.txt { Loop, parse, A_LoopReadLine, %A_Tab% { MsgBox, Field number %A_Index% is %A_LoopField%. } } %A_Index% 行号 %A_LoopField% 每行内容 内置变量 A_LoopField 存在于任何解析循环中. 它包含了 InputVar 中当前子字符串(片段) 的内容 分割字符串 解析一个逗号分隔的字符串. Colors := "red,green,blue" Loop, parse, Colors, `, { MsgBox, Color number %A_Index% is %A_LoopField%. } 逐行读取一个文本文件. 注意, 使用文件读取循环可以达到同样的效果(但性能更好). Loop { FileReadLine, line, C:\My Documents\ContactList.txt, %A_Index% if ErrorLevel break MsgBox, 4, , Line #%A_Index% is "%line%". Continue? IfMsgBox, No return } MsgBox, The end of the file has been reached or there was a problem.return 读取txt 全部内容 FileRead, OutputVar, C:\My Documents\My File.txt
联系客服