Skip to Content
0
Jul 24, 2020 at 05:55 AM

ctx.clipboard.set malfunction and change the newline character

130 Views

Hello RPA mates,

When I copy the following multi lines of numbers from notepad, and paste them to SAP GUI Multiple Selection, it works.

1910

2210

But in the following code, I tried to set the clipboard with defined text, then manually paste them to SAP GUI after each set method, SAP GUI always gave an error, complaining the content are not numbers.

After comparing the content, clipboard.set method changed \r\n line separator to \n automatically, anyone know how to prevent this or how to solve this?

Best Regards,

Mike

	var mytext = '1910\r\n2210';
	var copied = ctx.clipboard.get(); //copy the above numbers first then get them
	var eq = copied === mytext;  //true
	ctx.clipboard.set(mytext);
	ctx.clipboard.set(copied);
	var copied2 = ctx.clipboard.get();
	var eq2 = copied2 === mytext;  //false
	var mytext2 = '1910\n2210';
	var eq3 = copied2 === mytext2; //true

Attachments

paste-error.jpg (80.1 kB)