SetText replacing newline with spaces

Need some help. I have an option in a custom application to “copy to clipboard”. I have used UIpath to to “copy to clipboard” and retrieved using Get From Clipboard option in “result” attribute
Now I opened a website using UIPath and using “Set Text” to paste this data copied from clipboard in a Text Area. However, the issue is that newline in the data seemed to removed.

When i use WriteLine the same “result” from Get From Clipboard and check in output window, it shows new line.

What is going wrong? Does Set Text removed New Lines?

1 Like

Hi Subeed,

Try Type into activity.

Thanks,
Arun

2 Likes

Hi ,

Click on that particular field(where the data ti be pasted )

and send hotkey (ctrl + V )

1 Like

@Subeed_Ahmed not a big deal. Just add a newline with your to the set text activity and check if it works.

1 Like

The data is 25-30 lines … dont want to parse and send newline

same issue

Cant do that… i captured such “copy from clipboard” data 2 times & store in variables…

then login to website and paste in 2 different Text Area for further processing…

@Subeed_Ahmed Can you Show us a Screenshot of the Operations that you are Performing? Of the Xaml File?

2 Likes

Blockquote
This works perfectly if I have just once to paste from clipboard…
But as i said, I use Copy from Clipboard 2 times and store them in 2 different variables…

Set Text

Attached are 2 screen shots…pretty simple actually

Screenshot #1. Copy From Clipboard and store in a string variable kpCopy
Screenshot #2 Set Text with kpCopy variable

This removes the newlines from kpCopy string… there are appx 10-15 lines in this vailable

1 Like

@Subeed_Ahmed Why is the Variable houseCopy used as a result of Get ClipBoard?

sorry… i sent wrong screenshot… I use Copy From Clipboard on 2 different data sets in my desktop application and store in variables kpCopy and houseCopy. Pl read it as kpCopy for both screenshots

@Subeed_Ahmed Ok, Can you use kpCopy.ToString in SetText and check?

Tried that as well …same issue

So when I send Control V hotkey command to Text Area , it works well.
But when I assign clipboard data to a variable and SetText, newlines are removed… pretty odd actually…

@Subeed_Ahmed Also we would Like to See the Value in a Message Box, If that’s not a problem :sweat_smile:

data is indeed confidential… let me simulate with test data and send you

1 Like

hi @Subeed_Ahmed ,

so you have to remove new lines from a string use the below ,

text.ToString.Replace(System.Environment.NewLine,“”)

let me know if this works

TestFile.txt (130 Bytes)

@supermanPunch I simulated the same thing by creating a notepad with few lines and then used CLTR+C to copy to clipboard

And then I wrote a BOT to Get From Clipboard and store in a String variable. I logged in back to the website and used SetText … As you can see from screenshot, the newlines are gone

1 Like

@Subeed_Ahmed Can you manually Enter newlInes in the Field?