How to read data from a text file and put the data in Type Into box?

How do we read data from a text file and put the data in Type Into box? For example for signing in to a website I want to read the username and password from a config file. But I cant find an option to read a particular data from a text file. What I am able to do is : to create a variable and store hard coded values in it.

I am quite new in Uipath. Can anyone help me with this please?

Hi @abdult420,

you have to use string split function or activity based on number of lines in your text file,

Can you please elaborate the steps a litle?

Hi there @abdult420,
As noted by @Ajithkumar_P, you can use string manipulation to acquire the values you require.

You can achieve this in a few ways, one of which is SubString/IndexOf.

For example:

Assign - strReadFile = "Username: Bill Password: Bill123"

Assign - strUsername = strReadFile.Substring((strReadFile.IndexOf("Username:") + 10), ((strReadFile.IndexOf("Password:") - (strReadFile.IndexOf("Username:") + 10))))

This will retrieve the username value (“Bill”) from the original string and store it in strUsername.

This works by:
Taking a SubString of the original string at position 10 (starting position of ‘Username:’ + 10) for a length of 5 (starting position of ‘Password:’ [15] subtract the starting position of ‘Username:’ + 10 [10]).

As long as Username/Password exist in the text file in a sequential order, this will continue to work.