cancel
Showing results for 
Search instead for 
Did you mean: 

Losing clipboard when copying text from one application to another

NiallHarrigan
Level 2

Hey all,

Been having an issue lately and I was wondering if anyone has any suggestions.

I have written a process which opens letters in a company application, copies the text and then moves it to MSWORD in order to edit it. The process flow is as follows:

  • Open letter template in company application
  • Send CTRL+A
  • Send CTRL+X
  • Close company application
  • Open MSWORD
  • Send CTRL+V
  • Edit letter


This worked great until recently where now it seems to lose the clipboard between cutting the text and pasting into MSWORD. Has anyone experienced something similar to this or have any suggestions on another way to go about it?

Thanks!

2 REPLIES 2

Hi Niall,

Storing content in Clipboard can be a pretty volatile thing to do many times. In past I have faced this issue not in Blue Prism but in other RPA tools that I worked with where we had to copy the contents of Clipboard to a SAP list box using the F8 key. We saw that many times due to improper delays in the Bot this functionality posed erroneous outputs at times.

The more practical way to handle this kind of scenario is to immediately store the clipboard content to some Data Item once you copied everything and then in the process before pasting the data setting the clipboard content with the value stored in that same Data Item.

Please the find the detailed explanation of the following clipboard operations that we are going to use:

A) Storing Data From Clipboard:

In order to store the data from Clipboard to any data item, you can use the 'Get Clipboard' action from 'Utility - Environment' VBO which will accept an output argument where you can provide a sample data item to store that value. An alternative to this action is also using the GetClipboard() function in a Calculation stage where you can store the value to any sample data item. Either of the approaches will work.

B) Setting Data To Clipboard:

In order to set the data from a data item to a Clipboard, you can use the 'Set Clipboard' action from 'Utility - Environment' VBO which will accept an input argument where you can provide the data item whose value you need to store in the Clipboard.

C) Clearing Clipboard:

As a best practice, once the required clipboard operation has been completed, please remember to clear the clipboard to clean memory and avoid unnecessary content to be available for the next clipboard operation. This you can do by using the 'Clear Clipboard' action from 'Utility - Environment'

So your overall workflow will look something like this at the end of the day:

  • Open letter template in company application
  • Send CTRL+A
  • Send CTRL+X
  • Store the Clipboard Content To Data Item
  • Clear Clipboard
  • Close company application
  • Open MSWORD
  • Store the Data Item Content To Clipboard
  • Send CTRL+V
  • Clear Clipboard
  • Edit letter

Basically the highlighted action will be added to your workflow and the detail for the highlighted action I have explained above.

Also, if possible instead of pasting the data towards the end step try to directly write the data item content on the letter as it is a much reliable and better operation to use from efficiency purpose using either the pre-built MS Word VBO or your own custom object if any. In case you want to write the data at some specific cursor position, you can use the paste operation as shown above and pointing the cursor at the specified location in your letter.

NOTE: Please do consider providing few delay time between your operations in order to ensure that data is copied and pasted correctly.

Do let us know if this resolves your query.

---------------------------------------------------------------------------------------------------------------------------------------
Hope this helps you out and if so, please mark the current thread as the 'Answer', so others can refer to the same for reference in future.
Regards,
Devneet Mohanty,
SS&C Blueprism Community MVP 2024,
Automation Architect,
Wonderbotz India Pvt. Ltd.

wleung
Staff
Staff
Hello Niall,

I wonder if the following would help (ie. try to enable Clipboard history.) Also, once this is enabled, you may want to test and see if you may be running into situations where another application is acting on the clipboard. While I've seen very senior/experience RPA colleagues using the clipboard in Processes, I would highly recommend doing some validation of the content just in case for your automations (ie. cut/paste/read/validate before proceeding.)
- https://answers.microsoft.com/en-us/windows/forum/all/my-clipboard-keeps-clearing-itself-on-my-new-pc/c8f06a15-a346-4742-8d35-91f45444bbb7

One more thought is to include some additional action to make the procedure more explicit. For example:
- Focus on the application's text area before the Ctrl-A/Ctrl-X
- Small timeout between Ctrl-X and Application Close. Just in case any of those Win32 calls are not being served by the OS in the right order.

Some seemingly unnecessary things to try for sure but should help make the behavior more consistent.