Reads data from a file (usually a text file) and places the data in a variable. Commonly used to read data from a text file. For example, a user may want to read a list of names from a text file and use that data with the Send Keystrokes action to send the data to another application or use the Write to File action to write the data to another file. To do this, start with the Create Variable action. Then, use a Read From File action to place all the data into a variable. Thereafter, use the Loop List action to loop through the data. Inside the loop use the Write to File action.
Declaration
<AMFILEREAD FILE="text" RESULTVARIABLE="text" MAXBYTES="number" BYTESVARIABLE="text" NEWPOSITIONVARIABLE="text" POSITION="number" />
See Also: Split File, Move File, Create Folder, Delete File, Delete Folder, Rename Folder, Remove Folder, Touch File, Set Attributes, Write to File, Synchronize Folders, Concatenate Files
Property |
Type |
Required |
Default |
Markup |
Description |
File |
Text |
Yes |
(Empty) |
a)SOURCE="c:\sourcefolder\file.txt" b)SOURCE="filename.txt" |
The path and file name of the file containing the data that should be read. This can be a fully qualified path and file name (preferred) or a file name only (requires use of the Change Folder action). |
Populate Variable with Data |
Text |
Yes |
(Empty) |
a)DEST="c:\destfolder\file.txt" b)DEST="c:\destfolder\*.*" |
The name of the variable to populate with the text contents of the file. The variable must be created in a previous step using the Create Variable action. |
Read Entire File |
Null |
Null |
Null |
Null |
If enabled, the entire contents of the file will be read to a variable, If this option is selected, the Read File Partially parameter is ignored. This parameter is enabled by default. |
Read File Partially |
Null |
Null |
Null |
Null |
The default behavior is to read the entire file. However, you can set this action to read only a section of the file by enabling the Read File Partially option. This is useful if the file being read is particularly large in size. If this option is enabled, other parameters become active. |
Read from position |
Number |
No |
(Empty) |
POSITION="34" |
The position in the text file that this action should start reading from. Using this option along with the Limit number of bytes read to parameter can limit the amount of system memory used, thus speeding up execution. |
Limit number of bytes read to |
Number |
No |
MAXBYTES="7777" |
If enabled, specifies the maximum number of bytes that should be read from the text file. This limit is important because it prevents AWE from taking up a virtually unlimited amount of system memory depending on the size of the file. Text beyond this amount of space is truncated. |
|
Populate variable with new position in file. |
Number |
No |
(Empty) |
NEWPOSITIONVARIABLE="positionvar" |
The name of the variable to populate with the new position in the file. This allows you to retrieve data from a large file in sections. |
Property |
Type |
Required |
Default |
Markup |
Description |
Populate Variable with number of bytes read |
Number |
Yes |
(Empty) |
BYTESVARIABLE="bytesvar" |
If enabled, specifies the name of the variable to populate with the total number of bytes read. |