How to copy image to clipboard

How to copy image to clipboard? OR How to save screenshots inside a Citrix environment ? OR How to paste image in excel/word/ppt/paint?

Most of the times, we get a requirement to save Images/Data of the transactions/operations done inside a Citrix Environment for debugging or verification purposes.

Possible Solutions

  1. Taking the screenshot, saving it in a shared file location which is accessible from the citrix server.
  2. Using .Net functions to set the image to clipboard, and access it from there.

Description of Solution: 

  • Inside the workflow, drag a Sequence
  • Use "Take Screenshot" activity to capture the image, save the output in an image variable
  • Use "Invoke Method" activity to call "Set Image" method.  Details to be mentioned.  Target Type → System.Windows.Form.Clipboard, Method Name → SetImage, Parameters → Input → Image Variable (from the above step)
  • Use "Open Application" to open Paint or any other application to save the image from clipboard
  • Use "Send Hotkey" activity → "Ctrl +V" for pasting the image to Paint
  • Use "Send Hotkey" activity → "Ctrl + S" for saving the file
  • Use "Type Into" activity → to fill the location where you want to save the file
  • Use "Send Hotkey" activity → "Enter"
  • Use "Type Into" activity to provide the file name
  • Use "Send Hotkey" activity → "Enter" to save the file.
  • Use "Close Application" activity to close the Paint application.

 

Attached the sample workflow for reference under Related Section of the KB Article.