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.
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.