Read TXT
Take lines, or pieces between a delimiter, from a TXT file into a variable, optionally deleting them from the file.
In both apps
WarpX Browser
WarpX 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.
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\nfor a new line and\tfor 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.
1gives the item itself; any other number,0included, 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
- Start
- Read TXT
- Text tools
- New tab
- Forms
- Make
C:\Users\me\Documents\accounts.txtwith oneemail|passwordper line, such as[email protected]|Sunflower#42. - Add Read TXT after Start and set File path to that file.
- Leave Items are on One per line, Read on From the top and How many items (0 reads them all) at
1. - Tick Delete what was read from the file, and name the variable
account. - Press Preview data to check the file: it shows the first items and how many there are, such as
First 20 of 240 items. - Add Text tools with Split on
|into the variablesemail,password, then Forms blocks that type{{variables.email}}and{{variables.password}}. - Connect the fallback output to Notification with the text
accounts.txt is empty. - 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.