<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Internal : Could not execute code stage because exception thrown by code stage: The operation completed successfully in Product Forum</title>
    <link>https://community.blueprism.com/t5/Product-Forum/Internal-Could-not-execute-code-stage-because-exception-thrown/m-p/98802#M46476</link>
    <description>&lt;P&gt;&lt;SPAN&gt;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.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="35951.png"&gt;&lt;img src="https://community.blueprism.com/t5/image/serverpage/image-id/35963i9D176F7F20E5AFB1/image-size/large?v=v2&amp;amp;px=999" role="button" title="35951.png" alt="35951.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE class="language-vbnet"&gt;&lt;CODE&gt;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 &amp;lt;= 0 OrElse size.Height &amp;lt;= 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 &amp;amp; Format(Now, "dd-MMM-yy hh-mm-ss") &amp;amp; ".png"
    capture.Save(FullSavedScreenshotPath, System.Drawing.Imaging.ImageFormat.Png)
    ScreenshotImage = capture
    
Catch ex As Exception
    Error_Messages = ("Error capturing screenshot: " &amp;amp; ex.Message)
Finally
    g.Dispose()
End Try
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Output:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="35952.png"&gt;&lt;img src="https://community.blueprism.com/t5/image/serverpage/image-id/35971i10DAB6FDC30FB0A4/image-size/large?v=v2&amp;amp;px=999" role="button" title="35952.png" alt="35952.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 29 Nov 2023 22:48:00 GMT</pubDate>
    <dc:creator>jsantiago08</dc:creator>
    <dc:date>2023-11-29T22:48:00Z</dc:date>
    <item>
      <title>Internal : Could not execute code stage because exception thrown by code stage: The operation completed successfully</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Internal-Could-not-execute-code-stage-because-exception-thrown/m-p/98801#M46475</link>
      <description>&lt;DIV&gt;&lt;SPAN&gt;Dim startPoint As New Point(StartX, StartY)&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;Dim endPoint As New Point(EndX, EndY)&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;Dim size As New Size(endPoint.X - startPoint.X, endPoint.Y- startPoint.Y)&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;Dim capture As New Bitmap(size.Width, size.Height)&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;Dim g As Graphics = Graphics.FromImage(capture)&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;g.CopyFromScreen(startPoint, Point.Empty, size)&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;FullSavedScreenshotPath = OutputFolderPath &amp;amp; Format(now, "dd-MMM-yy hh-mm-ss") &amp;amp; ".png"&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;capture.Save (FullSavedScreenshotPath, System.Drawing.Imaging.ImageFormat.Png)&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;ScreenshotImage = capture&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;g.Dispose()&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;I am using above code to capture screenshot of the screen, where i am passing parameters startX, endX, startY, endY, OutputFolderPath.&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;this code was working fine for last couple of months but today when i run the bot got this error:&lt;BR /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;Internal : Could not execute code stage because exception thrown by code stage: The operation completed successfully&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;please help with this.&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;Thanks and Regards&lt;BR /&gt;Manoj Patidar&lt;/SPAN&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 29 Nov 2023 06:06:33 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Internal-Could-not-execute-code-stage-because-exception-thrown/m-p/98801#M46475</guid>
      <dc:creator>ManojPatidar</dc:creator>
      <dc:date>2023-11-29T06:06:33Z</dc:date>
    </item>
    <item>
      <title>Re: Internal : Could not execute code stage because exception thrown by code stage: The operation completed successfully</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Internal-Could-not-execute-code-stage-because-exception-thrown/m-p/98802#M46476</link>
      <description>&lt;P&gt;&lt;SPAN&gt;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.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="35951.png"&gt;&lt;img src="https://community.blueprism.com/t5/image/serverpage/image-id/35963i9D176F7F20E5AFB1/image-size/large?v=v2&amp;amp;px=999" role="button" title="35951.png" alt="35951.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE class="language-vbnet"&gt;&lt;CODE&gt;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 &amp;lt;= 0 OrElse size.Height &amp;lt;= 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 &amp;amp; Format(Now, "dd-MMM-yy hh-mm-ss") &amp;amp; ".png"
    capture.Save(FullSavedScreenshotPath, System.Drawing.Imaging.ImageFormat.Png)
    ScreenshotImage = capture
    
Catch ex As Exception
    Error_Messages = ("Error capturing screenshot: " &amp;amp; ex.Message)
Finally
    g.Dispose()
End Try
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Output:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="35952.png"&gt;&lt;img src="https://community.blueprism.com/t5/image/serverpage/image-id/35971i10DAB6FDC30FB0A4/image-size/large?v=v2&amp;amp;px=999" role="button" title="35952.png" alt="35952.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Nov 2023 22:48:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Internal-Could-not-execute-code-stage-because-exception-thrown/m-p/98802#M46476</guid>
      <dc:creator>jsantiago08</dc:creator>
      <dc:date>2023-11-29T22:48:00Z</dc:date>
    </item>
  </channel>
</rss>

