Internal : Could not execute code stage because exception thrown by code stage: The operation completed successfully
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
29-11-23 06:06 AM
Dim startPoint As New Point(StartX, StartY)
Dim endPoint As New Point(EndX, EndY)
Dim size As New Size(endPoint.X - startPoint.X, endPoint.Y- startPoint.Y)
Dim capture As New Bitmap(size.Width, size.Height)
Dim g As Graphics = Graphics.FromImage(capture)
g.CopyFromScreen(startPoint, Point.Empty, size)
FullSavedScreenshotPath = OutputFolderPath & Format(now, "dd-MMM-yy hh-mm-ss") & ".png"
capture.Save (FullSavedScreenshotPath, System.Drawing.Imaging.ImageFormat.Png)
ScreenshotImage = capture
g.Dispose()
I am using above code to capture screenshot of the screen, where i am passing parameters startX, endX, startY, endY, OutputFolderPath.
this code was working fine for last couple of months but today when i run the bot got this error:
Internal : Could not execute code stage because exception thrown by code stage: The operation completed successfully
please help with this.
Thanks and Regards
Manoj Patidar
Manoj Patidar
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
29-11-23 10:48 PM
I worked on the code to capture screenshots, made some tweaks, and gave it a test spin and it worked from my end. It looks good now.
Dim startPoint As New Point(StartX, StartY)
Dim endPoint As New Point(EndX, EndY)
Dim ScreenshotImage As Bitmap
Dim FullSavedScreenshotPath As String
If startPoint = endPoint Then
Exit Sub
End If
Dim size As New Size(Math.Abs(endPoint.X - startPoint.X), Math.Abs(endPoint.Y - startPoint.Y))
If size.Width <= 0 OrElse size.Height <= 0 Then
Exit Sub
End If
Dim capture As New Bitmap(size.Width, size.Height)
Dim g As Graphics = Graphics.FromImage(capture)
Try
g.CopyFromScreen(startPoint, Point.Empty, size)
FullSavedScreenshotPath = OutputFolderPath & Format(Now, "dd-MMM-yy hh-mm-ss") & ".png"
capture.Save(FullSavedScreenshotPath, System.Drawing.Imaging.ImageFormat.Png)
ScreenshotImage = capture
Catch ex As Exception
Error_Messages = ("Error capturing screenshot: " & ex.Message)
Finally
g.Dispose()
End Try
Output:
