Clipboard management

Clipboard management involves managing the activities of the clipboard, for example, getting text from the clipboard, copying selected text from the clipboard, and so on.

Let us see an example of getting text from the clipboard.

In this example, we will use Notepad. We will open Notepad, write some data into it, and then copy the data to the clipboard. We will then extract the data from the clipboard:

  1. Drag and drop a Flowchart activity from the Activities panel.
  2. Click on the Recording icon on the top of UiPath Studio. A drop-down menu will appear with the options, Basic, Desktop, Web, and Citrix, indicating the different types of recording. Select Desktop and click on Record.
  3. Click on Notepad to open it. A Notepad window will pop up:
  1. Click on the text area of Notepad. Type into the dialog box and check the empty field. (Checking the empty field will erase all existing data in Notepad before writing any new data.) Press Enter.

Data will be written on the Notepad text area:

  1. Click on the Edit button. A pop-up window will appear asking you whether you want to use an anchor. (An anchor is a relative element of the current {focused} element.) As you can see clearly, the anchor element of the Edit button can be the File or Format button. In this case, we have chosen the Format button:
  1. Then, it will automatically start recognizing the Edit button. Choose the Select all option from the drop-down list:
  1. Once again, click on the Edit button. It will again ask you to indicate the anchor element. Indicate the anchor button and the Edit button will be highlighted, giving you a drop-down box. Select the Copy option:

 

This copied text is now stored in the clipboard.

We can use the Get from clipboard, and Copy selected text activities to copy the text that is stored in the clipboard.

We will use the Copy selected text activity.

  1. Double-click on the Recording sequence that is generated by the recording. Scroll down and drag and drop the Copy selected text and Message box activities inside the Recording sequence:
  1. Create a variable of type String to store the output value of Copy selected text. This variable will receive the required text from the clipboard with the Copy selected text activity. Now, specify the newly created variable in the Output property of the Copy selected text activity. This will be the required selected text that we have copied into the clipboard.
  2. Specify the string variable in the text property of the Message box activity.
  3. Hit the Run button to see the result.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.225.255.134