How to get the value of a variable from a txt file

i only want “hello” to be printed and not CompName=“hello”

Hi @Nivedita2,

Refer this post

after getting array value using split option you can get “hello” alone

Regards,
Arivu

1 Like

1.>By default the cursor will point in the first line(if it does not Use Hot keys control + Home).

2.> Use Shift + End and it will highlight the text in the first line.

3.> Use Copy Selected text activity and store it in a a variable lets say Abc

4.> Use this assign activity
from : Abc.Split({“=”},StringSplitOptions.None)
To : abc_array

The output will be stored in array - lets say abc_array
Use msg box activity :slight_smile:
abc_array(1).

Output = “hello”

Now in msg box

@arivu96 i tired urs bt am getting the O/P as CompName=“hello” @prassin6 wen i tired urs…am getting the value of the 1st variable nd thn 2nd variable name

sample progrm:
test1.xaml (8.7 KB)

am getting it as

text file:

Hi @Nivedita2,

yes you will get this value only after that you need to split using “=” then only you will get the value.

Environment.Newline will give the array. line by line after that you can split easily.

Anyways you got the answer i hope. :slight_smile:

Regards,
Arivu

@arivu96 i tried it… yet am getting the same thing..and i want the first hello separately nd store it in a variable

test1.xaml (9.8 KB)

can u correct this and tell me where am i going wrong..

Hi @Nivedita2,

i was modified your xaml file please use this one
test1 (1).xaml (6.8 KB)

Regards,
Arivu

1 Like

@arivu96 thank u so much…this helpd me :relaxed:…can u suggest me a way…where i can store the result “hello” in a variable say “result”…so wen i give result in the message box…hello gets displayed… here in msg box it has got i.Split("="c)(1).ToString()…

Hi @Nivedita2,

use Dictionary
Dictionary dict= new Dictionary(Of String, String), if both your key and value are strings.
Key=i.Split("="c)(1).ToString()
value=i.Split("="c)(1).ToString()
image

Dict(“CompName”).ToString ->it will return the value as Hello

Regards,
Arivu

@arivu96 yea… it works… thank you :grinning: