Discussion

1
Replies
1635
Views
Juan Navarro (navaj)
PEGA
Senior RPA Technical Lead
Pegasystems Inc.
US
navaj Member since 2016 1 post
PEGA
Posted: January 23, 2017
Last activity: January 23, 2018
Posted: 23 Jan 2017 17:13 EST
Last activity: 23 Jan 2018 6:25 EST

How to Copy Text to Clipboard from Automations

Below are the steps to copy information to the user's clipboard from an automation.

1) Add a Script component to the project's global container

2) Add the following to using / imports section

using System.Threading;

3) Add a new Script

Name:CopyTextToClipboard

Parameters: string text

Result type: void

Method body:

Thread thread = new Thread(() => System.Windows.Forms.Clipboard.SetText(text));

thread.SetApartmentState(ApartmentState.STA); //Set the thread to STA

thread.Start();

thread.Join();

***Updated by Moderator: Marissa to change from a Question post to a Discussion; added FAQ group tag***

Robotic Process Automation Developer Knowledge Share