Print Chart at 6am

We now have several Easy Charts working, When you call up the page, it populates with the current days temperature, starting at 6am.

Is there a way to automatically print these charts on a daily basis, i.e. At 6am, the chart would print with data from 6am yesterday until now (6am today).

John

FactoryPMI doesn’t have a central Jython engine that always runs so you’ll have to have a running client. You also need to deal with cases where multiple clients are open or where certain clients don’t have the printer configured.

-First use something simple such as a button press to print the graph. You can either use fpmi.print.createPrintJob() or the easyChart’s print() function.

-Create a global timer script that runs periodically to determine if it’s time to print the graph. I would use a last_printed datetime in the database to ensure that you only print once a day this post gives an example db timestamp timeout query. I would also recommend maintaining a list of computers in a database table (either computernames or IP addresses) that have the printer configured. You can compare the clients info against the database values with the fpmi.net functions.

I’m not sure how to specify the printer (or use the default printer) and print without prompting the user. Typically, calling the print() function opens a print window. I’ll get back to you on this.

OK,

This gives me good ideas on how to do this.

I’ll keep you posted as to how this works out.

Thanks

john

If you want to print to the default printer without displaying the print dialog window do the following:

job = fpmi.print.createPrintJob(Component) job.setMargins(0.5) job.zoomFactor = 0.75 job.showPageFormat = 0 job.showPrintDialog = 0 job.print()

Hope this helps.

I just set up a printer for the customer, and am using print() from the table component. Is there a parameter available to define the orientation? Or, is there a way to save the print parameters in the dialog box?

I see there is an orientation setting for createPrint Job, but I don’t know if I can use that in conjunction with the table.print().

No there isn’t an orientation option with the table’s built-in print() function. I’ll add this as a feature request. You could get more control over the printing of a table if you made the table a report using the Reporting Plugin, or you might be able to set the default (in Windows) on the printer to landscape (this would create a per-client setup issue though…)

I tried setting the printers properties within windows, but the pop-up window properties always overrode them.

That said, the pop-up dialog now is storing the landscape orientation. I rebooted the client previously for another reason, and now I don’t have to change it anymore. Is it possible that whatever loads the defaults for the pop-up only reads them only on start-up?

Anyway, I’ll have the customer keep an eye on it, and see if there is a pattern. Thanks.

Yeah, that is possible. Keep an eye on it…