|GSAK (Geocaching Swiss Army Knife)|
Use this command to read a text file.The GetFile function reads all the data into the one variable. The FileRead command allows you to iterate through any size text file and read in the lines one at a time. The opening, reading, and closing of the text file is all done for you. All you need to do is place your macro code between the FileRead and EndRead commands, using the automatically generated macro variable $line to represent the current line in the text file. If at any time you would like to terminate reading the file before the end of file is reached, use the STOPREAD command. For example, to count the number of blank lines in a text file:
File - The fully qualified text file to read
Note1: Each FileRead command must have a corresponding EndRead command.
Note2: Currently, the FileRead command can only process one file handle per macro  so you can't nest this command in while or if statements. The work around to use the MACRO command. As this command creates another complete new instance of the macro engine, you get another file handle and it works.
Note3: Lines must have the Windows terminator of "Carriage return" and "Line Feed" (Cr/Lf). Linux or any other terminator will result in all the data being read as just one long line.
 Simultaneous access that is. You can open and close (fileread - endread) as many files as you like in the same macro, but they cannot be nested.
Alpha List Category List
Copyright 2004-2014 CWE Computer Services |