Question
TCS
IN
Last activity: 19 Mar 2018 13:14 EDT
Capture screenshot - RPA
I can able to screenshot through RDA and RPA . In both the cases , windows to be captured are active and my script will take screenshot what are available in the screen.
Is there any way to capture screenshot in background processing with no windows screen active in front?
Please help me with your suggestions.
Parameters: string outputImagePath, int width, int height, int xCoordinate, int yCoordinate
Method body:
bool result = false;
if (string.IsNullOrEmpty(outputImagePath))
{
return false;
}
OpenSpan.Diagnostics.Diagnostic.TraceVerbose("Script", string.Format("Attempting to grab screen shot {0}/{1}/{2}/{3}", width, height, xCoordinate, yCoordinate));
try
{
Bitmap screenshot = new Bitmap(width, height, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
Graphics screenGraph = Graphics.FromImage(screenshot);
screenGraph.CopyFromScreen(xCoordinate, yCoordinate, 0, 0, new Size(width, height), CopyPixelOperation.SourceCopy);
screenshot.Save(outputImagePath, System.Drawing.Imaging.ImageFormat.Png);
result = File.Exists(outputImagePath);
}
catch (Exception ex)
{
OpenSpan.Diagnostics.Diagnostic.PublishException(ex, null);
result = false;
}
return result;