I have a run time email report that I have ignition send out every week to the plant managers that tells them how many hours each robot cell ran for the week. I have been asked to include the bar chart from my project in the email. does anyone know if its possible to capture the bar chart and include it in an email or if there is a way to do a screen grab and include it in the email?
pretty sure you can do it but you would need to have a special client running all the time and write some scripting to startup at the specified time that first makes sure you have the latest data, then exports out the window, then creates and sends the email.
Well its been a year since I first posted this question and im back to trying to figure it out… I have the following code that works perfectly in the script playground. but when I use it in a gateway timer script it will not run. Im not finding anything in the log. Any ideas? thank you.
[code] import system
from javax.imageio import ImageIO
from java.io import ByteArrayOutputStream
Gateway Timer Scripts run on the Gateway. Windows run in designers and clients but not in the Gateway. Functions like system.gui.getWindow will not work in Gateway Event Scripts.
You could use a Client Timer Script that runs this code in an open client somewhere.
As nmudge said gateway scripts run in the Ignition Gateway and components and windows are client scoped, this means that from your gateway script you will not have access to your bar chart.
To include your chart in the email as an you can use a client script instead of a gateway script, and make sure that a client is up and running when you need to send that email.
Or you can save a copy of that chart in a client script to a network location that the gateway can reach, then attach the previously saved image, to your email. The downside here is of course that the chart pictured is not the most up to date version.