Support Portal

for ProcessRobot and WinAutomation

Start a new topic
Answered

Read from list

I know this is a simple process but cant figure it out.

I have a text file on my desktop that contains lines of words

One on each line.


I want a way to read the file and pick the word in the first line then enter that in a variable, then move on and read the next line and place that in the same variable and so on and so on.


Best Answer

Hi John,


In order to read each line's contents separately, you can use the Read Text from File action and from the action's properties Store file content as: choose the option List (each line will be a list item).


This way, you can access each line's contents from the list accordingly. For example, for the 1st line you can use %FileContents[0]%, for the 2nd %FileContents[1]%, etc.


Afterwards, you can proceed as needed (for example, by setting these values to separate variables, iterating the list's items with a For Each loop, etc.

1 Comment

ADMIN
Answer

Hi John,


In order to read each line's contents separately, you can use the Read Text from File action and from the action's properties Store file content as: choose the option List (each line will be a list item).


This way, you can access each line's contents from the list accordingly. For example, for the 1st line you can use %FileContents[0]%, for the 2nd %FileContents[1]%, etc.


Afterwards, you can proceed as needed (for example, by setting these values to separate variables, iterating the list's items with a For Each loop, etc.

Login or Signup to post a comment