cancel
Showing results for 
Search instead for 
Did you mean: 

Copy File to Clipboard

TadasCirklys
Level 2

Hello, I ran into some issues when trying to copy a file to clipboard and then pasting it into an application later on.  I've tried a few Custom code solutions:

C#:

StringCollection paths = new StringCollection();
paths.Add(File_Path);
Clipboard.SetFileDropList(paths);

This throws an error in Code Check - Compiler error at line 0: The modifier 'public' is not valid for this item

Visual Basic:

Dim f() As String = {filePath}
Dim d As New DataObject(DataFormats.FileDrop, f)
System.Windows.Forms.Clipboard.SetDataObject(d, True)

This one seems to be working when pasting the file to another folder. When I run this stage I do get the file in the clipboard and I can successfully paste it into different folder, however when I perform Ctrl+v on the app(both manually and via bp), it does not work. When I try to Ctrl+c the file manually and Ctrl+v it into the app(again both manually and via bp) it works, so I wonder if there is any difference between me ctrl+c'ing the ifle and getting it to clipboard via script? If so what is the difference and how can I get it to work the same as if I was doing it by hand?



------------------------------
Tadas Cirklys
------------------------------
3 REPLIES 3

Denis__Dennehy
Level 15

If sending the keystokes manually works,  have you tried using Surface Automation techniques and using Global Sendkeys to send your Ctrl-C and Ctrl-V key strokes rather than using your own code?  It seems strange to try building your own code rather than using functionality built into the Blue Prism product?

AlexHim
Staff
Staff

Hi Tadas,

I'd suggest posting your question on the Blue Prism community forum instead of the Process Intelligence community. More eyes that know Surface Automation are on that community page, and can help you. 🙂



------------------------------
Alex Him
Solution Engineer
SS&C Blue Prism
New York, NY
------------------------------
Alex Him Solution Engineer SS&C Blue Prism New York, NY

I'll move this over to the Blue Prism forum for you!



------------------------------
💙 Michael
(I'm part of the SS&C Blue Prism Community Team)
------------------------------