How to copy an image file into clipboard?

Hi there, can anyone help me on this: How to copy an image file into clipboard?
Thanks!!!

instead of the System.Windows.Forms Clipboard
we can work with the
System.Windows.Clipboard Class

e.g. with the methods:

Whenever it is not working by the first try ensure, that also an image within the clipboard

and also the debugging panels for inspections and rnd

1 Like

Hi Symos,

Assuming that you are trying to take a screen shot and then Trying to save the image already in clipboard as a png file.

Step 1 : Use Invoke method activity (To Take a Screen Shot using ‘PrtScrn’),
Set Target Type - System.Windows.Forms.Sendkeys and MethodName - SendWait

Parameter : Direction - In , type - String , value - “{PRTSC}”

Doing the above step will get the image/screenshot to clipboard

step 2 : Assign Activity,

Create a variable of type ‘System.Drawing.Image’ and and in the value field provide ‘System.windows.forms.clipboard.getimage’

Step 3 : Save Image Activity

Use the Image variable created in Step 2 as input along with the File Name (Path/Nam.extension) to save the image from clipboard.

Attached the Sequence for your reference.

TestScreenshot.xaml (6.8 KB)

Hope this helps, else let me know more about your question had I misunderstood with a more detailed use case containing steps before and after.

Happy Automating…!

1 Like

In the save image activity, Extension must be of image type (png,jpeg etc.,)
I have made a typo there, Please consider that as png in sample flow I had attached.