Guys I want to email a chart, I have written this script in client event script. It works but I get multiple copies of the email, more than the 2 clients that are open. How can I limit it to one email please?
[i]if newValue.value == 1:
import system system.nav.openWindow("Main Windows/Processing/Pulp_Trend_Email") def email(): from javax.imageio import ImageIO from java.io import ByteArrayOutputStream window = system.gui.getWindow("Main Windows/Processing/Pulp_Trend_Email") image = window.rootContainer.getComponent("Easy Chart") bufferedImg = system.print.createImage(image) baos = ByteArrayOutputStream() ImageIO.write(bufferedImg, "PNG", baos) fileData = baos.toByteArray() fileName = "history.png" smtp = "XYZ.local" sender = "SCADA@XYZ" subject = "Pulp Trend" body = "Chart email." recipients = ["person@XYZ"] system.net.sendEmail(smtp, sender, subject, body, 0, recipients, [fileName], [fileData]) system.nav.closeWindow("Main Windows/Processing/Pulp_Trend_Email") system.util.invokeLater(email,4000) chart()