I have run across an issue with an client script used to automatically print a report at midnight. The script is defined below:
name = system.security.getUsername()
if name == ‘admin’:
system.nav.openWindow(“Advanced/Totalizers”)
window = system.gui.getWindow(“Advanced/Totalizers”)
job = system.print.createPrintJob(window)
job.showPrintDialog = 0
job.setMargins(0.5)
job.fitToPage = 1
job.orientation = system.print.LANDSCAPE
job.showPageFormat = 0
job.print()
When the script is triggered, the printout is blank unless I change the job.showPrintDialog to = 1. This makes it so that the user has to interact to get it to print.
I want the printout to work without user interaction. I have tried using import time, and time.sleep(3) after defining the job, but it still comes out blank.
What can I do to get this working without having job.showPrintDialog = 1? Invokelater?
I was able to get the client script used to automatically print without user interaction working by making the following changes:
name = system.security.getUsername()
if name == ‘admin’:
system.nav.openWindow(“Advanced/Totalizers”)
system.nav.closeWindow(“Advanced/Totalizers”)
system.nav.openWindow(“Advanced/Totalizers”)
window = system.gui.getWindow(“Advanced/Totalizers”)
def graph(window = system.gui.getWindow(“Advanced/Totalizers”)):
import system
# Get the interior section of the chart
innerChart = window.getComponent(0)
job = system.print.createPrintJob(innerChart)
job.orientation = system.print.LANDSCAPE
job.showPrintDialog = 0
job.print()
#Print 10secs after property change
system.util.invokeLater(graph, 10000)
Anyone have a solution for this that doesn't involve closing windows?
I have a popup that displays a barcode, it prints on a Dymo LabelWriter 450 Turbo just fine with the dialog, but when I try it without a get a blank label automatically printed.
try:
#Print the Barcode to a Label
job = system.print.createPrintJob(event.source.parent.getComponent('Barcode'))
job.setOrientation(0)
job.setPrinterName("DYMO LabelWriter 450 Turbo")
job.setPageHeight(40)
job.setFitToPage(1)
#job.setShowPrintDialog(0)
job.print()
except:
1
system.nav.closeParentWindow(event)