How can i store some text inside a variable?

hello all!
so i need to somehow store inside a variable some text from a notepad. i managed to do CTRL+C on it and CTRL+V to paste it inside a word file for example, but how can i save it inside a variable, for comparisons purposes later?
i understood i need to do it with “get from clipboard”, and tried to play with it but i cant managed to make it work… im trying to solve this simple problem for a couple of hours already (just started learning today).
would love some help, thanks in advance!

Hi,

GetFromClipboard activity will work as the following. Is there any different with yours?

Regards,

Hi @wsm1 ,
there is no need of using hotkeys, get clipboard activity and all for this process. We usually do not use this way.

Instead you can use read text activity for notepad and append text activity for word.

I am also attaching a sample workflow with sample files please do have a look. I hope it might help you.
CopyTxtFileToExcel.zip (10.3 KB)

Thanks & Regards,
Shubham Dutta

Hello @wsm1 WElcome to Uipath Community

  1. You can use Ctr+A to select all
  2. Use the Copy Selected Text and scan store in a variable, use value where you need it.

If copied the text to Clipboard, then use “Get From Clipboard” activity and results can store in variable

image

thanks everyone! i managed to now save it, i save it as a string but when im doing if operations on it it says “If: Input string was not in a correct format.”

any idea why? the first time i do it its for an empty string so in the if i tried several methods, like (str.equals(“”)) or str.ToString.Equals(“0”)

Hi,

Can you share screenshot of the IF activity with error message.

Regards,

hey i managed to fix this problem, but my robot still dont go to the right choice. (i mean, im getting false when its true)

what i do is i mark the text, CTRL+C, and via “Get from clipboard” save it in a variable. this method is working when there is something marked, but sometimes i mark an empty box and save it into a variable, so basicly wanting to save it as an empty string.
then when im doing a condtion that basicly says “if this string is empty”, it goes to the else.
maybe i get this problem because when my clipboard got empty, i cant save it into an empty string?

EDIT:

i just did a check and the string i get is not qualified as empty as some reason… any reason why?

EDIT 2:
i tried with an empty excel cell. clicking it one time, CTRL+C. i save it and the string length i get is 2.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.