cancel
Showing results for 
Search instead for 
Did you mean: 

Procedure to take screenshot

Mohd_Daud2
Level 4
Hi, I am trying to take screen shot of the screen. I am following these steps: 1) Sending global sent keys for print screen key. 2) Creating MS Word Instance. 3) Creating MS Word document. 4) Pasting screenshot from clipboard. 5) Saving document at some location. 6) Closing the instance. But in the first step itself I am not able to take screenshot. I have tried using "{PRTSC}" in navigation stage as I have found on microsoft site: https://msdn.microsoft.com/en-us/library/8c6yea83(v=vs.84).aspx Please suggest me the correct procedure. Also I want to know how can I save the screenshot as a pdf or png image? Thanks.
17 REPLIES 17

hi , how we can do this?

------------------------------
cissoko yann
------------------------------

i , can i have a capture?

------------------------------
delacoche silver
------------------------------

we don't find this in blue prism vbo

------------------------------
delacoche silver
------------------------------

Hi Delacoche,

I faced this issue in past, for some reason on DX exchange also I wasn't able to find the object. So here is what I did which was to create my very own object to do that.

You can create a new business object called 'Utility - Screenshots' and the provide the following 'External References' : System.Drawing.dll , System.Windows.Forms.dll along with the 'Namespace Imports' as : System.Drawing, System.ComponentModel, System.Drawing.Imaging and System.Windows.Forms  keeping the 'Language' as Visual Basic under the 'Code Options' tab of your Page Description stage in the 'Initialise' action as shown below:

12305.png

Add a new action called 'Take Screenshot' with two input parameters called 'Screenshot File Path' of type text and 'Screenshot File Name' of type text and map them to their respective data items as shown below:

12306.png

Add a code stage called 'Take Screenshot' with the input arguments as shown below:

12307.png
Now you can add the following code to take screenshots:

Dim bounds As Rectangle
Dim screenshot As System.Drawing.Bitmap
Dim graph As Graphics

bounds = Screen.PrimaryScreen.Bounds
screenshot = New System.Drawing.Bitmap(bounds.Width, bounds.Height, System.Drawing.Imaging.PixelFormat.Format32bppRgb)
graph = Graphics.FromImage(screenshot)
graph.CopyFromScreen(0, 0, 0, 0, bounds.Size, CopyPixelOperation.SourceCopy)
screenshot.Save(Screenshot_File_Path+"\"+Screenshot_File_Name)
screenshot.Dispose

12308.png

Once this has been completed, you can publish the action and save the business object. Test the same from process studio providing the input arguments for the screenshot folder path and the screenshot file name.

------------------------------
----------------------------------
Hope it helps you and if it resolves you query please mark it as the best answer so that others having the same problem can track the answer easily

Regards,
Devneet Mohanty
Intelligent Process Automation Consultant | Sr. Consultant - Automation Developer,
Wonderbotz India Pvt. Ltd.
Blue Prism Community MVP | Blue Prism 7x Certified Professional
Website: https://devneet.github.io/
Email: devneetmohanty07@gmail.com

----------------------------------
------------------------------
---------------------------------------------------------------------------------------------------------------------------------------
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.

thx , i will test it now

------------------------------
delacoche silver
------------------------------

Hi Devneet, 

is there any way to attach particular application and take only screenshot of it instead of full desktop screenshot and save it in some path ?

Iam developing a bot where we need to take screenshots of particular application by and save it in word file and export that word as PDF . Is there any way you can help with this ?



------------------------------
DILIPKUMAR S
------------------------------

Hi DilipKumar S,

Q) is there any way to attach particular application and take only screenshot of it instead of full desktop screenshot and save it in some path ?
Its definatley possible, 
1) Calculate the dimensions from browser, when it is in maximize state 
2) Pass the  dimensions  while taking the screenshot.



------------------------------
-----------------------
If I answered your query. Please mark it as the "Best Answer"

Harish M
Lead developer
America/New_York TX
------------------------------
-----------------------
If I answered your query. Please mark it as the Best Answer

Harish Mogulluri

Can you explain how to pass dimensions and take screenshot of the page ?



------------------------------
DILIPKUMAR S
------------------------------