Text File Process

 

The Text File Process command reads each line of a text file into a variable. The entire line of text is saved into a single variable.

 

 

Script Editor > Expand Files or Folders Category > Text File Process

 

 

Each line of the text file is loaded into a variable which can be used later in the macro. Select which line of the text file to begin with and either process all the lines from that point or just process a specific number of lines. Use of the variable and processing take place between the command to open the text file and the command to end the text file processing.

 

 

Cautionary Note: Do not manually edit or have another program edit the file during the processing, as this may cause unpredictable results on the computer. If you need to edit or update the file while the Text File Begin Process command is running, then have the macro make a copy of the file and process the file copy.

 

 

Example

 

If a text file contains the following data:

 

FMC,"98 SE, 2000",,Talon,750 MHz,256 B,,83

H,95 B,5.00.3314.2101,P II,333 MHz,65 B

H,"98 SE, 2000",5.00.3314.2101,P III,550 MHz,384 B,,,"17"" Flat"

 

and variable T[1] is used as the "Variable to Receive First Field".

 

The first time through the Process loop the variables will be:

  T[1] = FMC,"98 SE, 2000",,Talon,750 MHz,256 B,,83

 

The second time through the Process loop the variables will be:

  T[1] = H,95 B,5.00.3314.2101,P II,333 MHz,65 B

 

The third time through the Process loop the variables will be:

  T[1] = H,"98 SE, 2000",5.00.3314.2101,P III,550 MHz,384 B,,,"17"" Flat"

 

 

File Name

Insert the name of the text file to be opened and processed. Click on the Browse button to locate the file and path or enter manually.

 

 

Variable to receive result

This is the text variable that receives the value of the text line in the file. This variable may then be used and processed by other macro commands.

 

 

Begin processing on record ___

Use this option to select which record to begin processing in the file. To process the entire file, enter 1 in the value field to indicate starting with the first record. Or use an Integer variable when specifying which record to start processing and the number of records to process. 

 

 

What to process

Process All Records

Select this option to process every record in the file, if electing to start with record #1. Or it will start with the record selected and process all subsequent records.

 

Process Partial Records

Choose the "Process Partial Records if only needing to process a certain range of records (or lines of text).

 

Number of records to process

Enter in this field the number of records to process if not processing all records in the file.

 

 


 

 

Text File End Process

Each Text File Begin Process command requires a corresponding Text File End Process command. All commands in the script between the Begin and the End Process commands will be repeated the number of times instructed.

 

 

üNote: If all records have been read out of the text file and processed, then control goes to the macro command that immediately follows the Text File End Process command.

 

 

See Also 

ASCII File Begin Process

Break

Continue