Block reference / Data

Read TXT

Take lines, or pieces between a delimiter, from a TXT file into a variable, optionally deleting them from the file.

In both appsWarpX BrowserWarpX Phone

Use this block to feed a run from a plain list: accounts, proxies, search terms, one per line. It reads from the top, from the bottom or at random, and can delete what it read so the next run gets the next item. Profiles running at the same time never get the same line. When the file runs out, the block leaves by its fallback output. It works only in the WarpX Browser desktop app.

The Read TXT block's settings, filled in as in the example below.

Settings

File path

The whole path of the text file. A leading ~ means your home folder. The folder button opens a file dialog. A file that does not exist stops the block with an error.

ExampleC:\Users\me\Documents\accounts.txt
Items are

One per line reads each line as an item. Separated by a delimiter splits the file on a character instead, for data written on one line.

ExampleOne per line
Delimiterwhen Items are: Separated by a delimiter is chosen

The text between items, such as , or ;. Write \n for a new line and \t for a tab.

Example;
Read

From the top takes the first items. From the bottom takes the last ones, the last line first. At random takes items from anywhere in the file.

ExampleFrom the top
How many items (0 reads them all)

How many items to take. 1 gives the item itself; any other number, 0 included, gives a list.

Example1
Delete what was read from the file

Takes the items out of the file as they are read, in the same step, so each run gets items no other run has had. Blank lines are removed at the same time.

ExampleChecked
Assign to variable

Keeps what was read in a variable. It is ticked when you add the block.

ExampleChecked
Variable namewhen Assign to variable is ticked

The variable to write to. Read it later as {{variables.account}}.

Exampleaccount
Insert to table

Writes each item into a table column as well.

ExampleUnchecked
Select columnwhen Insert to table is ticked

The column to write to.

Exampleaccount

Every block also has the shared block settings — a description, Disable block and what to do on an error. Fields that take text accept data from earlier blocks.

What it hands on

Hands on the item, or the list of items, which the next block reads as {{prevBlockData}}. The log line says how many were read and, with deleting on, how many are left, such as Read 1 of 240, 239 left in the file. When the file has nothing left, the block leaves by its fallback output, or stops with The file has nothing left to read if nothing is connected there.

Example: Give each profile the next account from a list

  1. Start
  2. Read TXT
  3. Text tools
  4. New tab
  5. Forms
Where Read TXT sits in the example workflow.
  1. Make C:\Users\me\Documents\accounts.txt with one email|password per line, such as [email protected]|Sunflower#42.
  2. Add Read TXT after Start and set File path to that file.
  3. Leave Items are on One per line, Read on From the top and How many items (0 reads them all) at 1.
  4. Tick Delete what was read from the file, and name the variable account.
  5. Press Preview data to check the file: it shows the first items and how many there are, such as First 20 of 240 items.
  6. Add Text tools with Split on | into the variables email,password, then Forms blocks that type {{variables.email}} and {{variables.password}}.
  7. Connect the fallback output to Notification with the text accounts.txt is empty.
  8. Run the workflow on 20 profiles at once. Each takes a different line, and the file shrinks by 20.

Good to know

  • Desktop app only. In the browser extension the block is not in the list.
  • Reading and deleting happen together, under a lock on the file, so two profiles running at once never get the same line.
  • Each item is trimmed of spaces, and empty lines are skipped. With deleting on, the rest of the file is written back as it was, minus what was read and any blank lines.
  • An empty file, or one with only blank lines, is not an error: it is the list running out, and the block leaves by its fallback output.
  • Preview data reads the file now, so it needs a path without variables. It shows the first 20 items and never deletes anything.
  • The file is read as UTF-8, and a byte order mark at the start is ignored. Files over 50 MB are refused.
  • Keep the file closed in your text editor while a run deletes from it: saving it there writes back the lines the run already took.

See also

  • File action — Write a value to a TXT, CSV or JSON file on the computer, append to one, or delete a file.
  • Loop data — Run the blocks after it once for each row, number, list item or element.
  • Get file path — List the files in a folder, by full path, into a variable you can loop over.
  • Excel — Read cells from an Excel workbook on the computer, or update, append, clear, create a workbook or add a sheet.