[Tips] Take a Screenshot of Servoy
Here's a bit of code that will take a screenshot of Servoy's main window:
/*
* Get a screenshot of the main Servoy window
* Requires the images plugin to work
*
* globals.myScreenShot (type: media) contains the data you can put into a column of type blob
*
**/
//get screensize of window
var x = application.getWindowX()
var y = application.getWindowY()
var width = application.getWindowWidth()
var height = application.getWindowHeight()
//get screenshot
var screenShot = (new java.awt.Robot()).createScreenCapture(new java.awt.Rectangle(x,y,width,height))
var rawData = new java.io.ByteArrayOutputStream()
Packages.javax.imageio.ImageIO.write(screenShot,'png',rawData)
globals.myScreenShot = rawData.toByteArray()
Kind of an oddball piece of code but we have found this to be useful in user feedback systems. In one implementation, from any screen a user can trigger a feedback ticket:
[image unavailable: Picture 9]
And fill out some typical feedback type stuff:
[image unavailable: Picture 10]
In the panel where we manage feedback tickets, a handy screenshot of where the user was at when filling out the ticket is displayed:
Comments (2)