Button to Email A Mimic

I have a request from a customer to provide a button to do a screen capture and email the screen capture to an email address entered by the user.
I’ve done a button already to email pdf reports to an entered email address but I’m not sure if it would be possible to capture the screen as a jpg or bmp and email it.

Any ideas or advice would be greatly appreciated.

Take a look at the system.print.printToImage function.

I do this as a help function in my systems. Basically, when a user clicks the help button, it takes a screen shot then retargets into my help program.
Here is a subsection of that code that would reside in the script modules.

def takeScreenShot(event):
	from system.gui import getParentWindow
	from system.print import createImage
	from system.net import sendEmail
	from java.io import ByteArrayOutputStream
	from javax.imageio import ImageIO
	# Get an image of the entire screen as seen by the user.
	# By using getParentWindow(event).parent, you are grabbing the entire session.
	# This will include any docked windows.
	# Is returned as a bufferedImage. Need to convert it to a byteArray.
	# Instantiate an object of ByteArrayOutputStream.
	baos = ByteArrayOutputStream(10000)
	# Write the bufferedImage returned by the getParentWindow(event).parent as a ByteArrayOutputStream.
	ImageIO.write(createImage(getParentWindow(event).parent), 'jpg', baos)
	# Flush the stream.
	# Convert the ByteArrayOutputStream to a byteArray.
	screenShot = baos.toByteArray()
	# Close the stream.
	# Send the email. 
	sendEmail(smtp, from, subject, body, html, to, ['screenShot.jpg'], [screenShot])

Will have to replace the variables in the sendEmail call with your specific values.
Could be converted to be used in an event handler as well.

Many thanks for the code, it worked a treat!