Screen Capture - Forum

Forum Navigation
You need to log in to create posts and topics.

Screen Capture

Is there a way I can have my app capture the screen and save it to a file?

There is a new Screen Capture API for JavaScript, but I have never used it yet:
https://developer.mozilla.org/en-US/docs/Web/API/Screen_Capture_API/Using_Screen_Capture

In theory it should be possible, even capturing other applications screens.

Regards.

Hi overthere,

I'm not VNWeb User.

I don't know if  VNWeb has an interface with PowerShell

If yes, this script could be useful for you:

 

$File = "c:\disco viejo\MyFancyScreenshot.bmp"
Add-Type -AssemblyName System.Windows.Forms
Add-type -AssemblyName System.Drawing
# Gather Screen resolution information
$Screen = [System.Windows.Forms.SystemInformation]::VirtualScreen
$Width = $Screen.Width
$Height = $Screen.Height
$Left = $Screen.Left
$Top = $Screen.Top
# Create bitmap using the top-left and bottom-right bounds
$bitmap = New-Object System.Drawing.Bitmap $Width, $Height
# Create Graphics object
$graphic = [System.Drawing.Graphics]::FromImage($bitmap)
# Capture screen
$graphic.CopyFromScreen($Left, $Top, 0, 0, $bitmap.Size)
# Save to file
$bitmap.Save($File) 
Write-Output "Screenshot saved to:"
Write-Output $File

Greetings from Buenos Aires,

David de Argentina

I don't know if VNWeb has an interface with PowerShell

No, it doesn't have such possibility, except when compiling as a desktop app using neoEdge.
Screen Capture API should work on any environment.

Regards.