track virtual queues

PaperCut Print Script of the Month #7 – Track Virtual Queues

PaperCut print script of the month – how to track virtual queues

So this month our trip into the world of PaperCut Advanced Scripting (Print Scripting) comes off the back of a few calls from customers who would like to know how many jobs are being sent through their greyscale find- me queue.

If this is something, you are trying to do go and grab an espresso as this won’t take long, and we can get started.
The idea here is we need to increase a value that can be viewable and reset from the admin interface as required. We would only want to count jobs that have been printed, and this is where the method below will come in.

actions.utils.onCompletionIncrementNumberProperty(propName, value[, options])

The method will increase a global number by whatever value we tell it, The propName is going to be what we call this count, and we can use it to find the property later. This method is also only run once the script has finished and the job has been printed out so you won’t be counting any jobs that are currently pending release.

In our test environment, the queue is called “Green Queue” so we are going to call the property green-queue. Once this bit has been worked out, we will need to work out what we want to increase the value by. We want to know the number of pages that were printed out so we can use inputs.job.totalSheets.

Now all that is left is to put this together and give us the one line that we need.

actions.utils.onCompletionIncrementNumberProperty('green-queue', inputs.job.totalSheets);

To see the result of this, you can go to Options > Config Editor and search for your property name, and you will be able to see how many pages have been printed out and reset the value if you want.

Of course, if you wanted to display the value in a pop-up message you could use the method below and remember to replace propName with whatever you used to set the value with.

inputs.utils.getNumberProperty(propName)

That is it for this month and as always the complete print script to track virtual queues is available below. If you have your own requirements for a print script and you don’t have the time or in-house experience to make it you can find out how we can help you by sending an email to our sales team at sales@selectec.com

You might also be interested in:

PaperCut Print Script of the Month #4 – Only allow colour printing from certain applications

/*
 * Track sheets printed on virtual queue
 *
 * Read more at http://selectec.com/script-of-the-month-7-count-virtual-queue-sheets/
 */
function printJobHook(inputs, actions) {
 
 if (!inputs.job.isAnalysisComplete) {
 // No job details yet so return.
 return;
 }
 
 // Show current sheets
 actions.client.promptOK('So far "' + inputs.utils.getNumberProperty('green-queue') + '" pages have been printed using this queue');
 
 // Increment green-queue by total sheets in job
 actions.utils.onCompletionIncrementNumberProperty('green-queue', inputs.job.totalSheets)
 }