img

PaperCut Script Troubleshooting


Using a PaperCut Script using advanced scripting brings a whole new level to the control you have over a print job. That power can also bring with it a few technical issues if the code for the script is not perfect.

We are happy to troubleshoot script problems and below is a sample of our thoughts during the process.

We were sent a script that was not working as expected, you can see this script below.

Puting Things Right

Our first step is to always add the script to our own test installs of PaperCut and see what happens. In this instance, the script worked fine for us, which is a bit odd the customer was getting a message about an error displayed in PaperCut. The error in question was:

To break this down, we can see the message is informing us that on line 27 (printer-script#27) there is a problem with actions.client.promptForChoice, If you look at the parameters being used we have a string, an object and something that is undefined.

When we look at the line in the code we can see this:

So we know the string is the “Are you sure you want to print in colour?” and the Object is the options variable. This suggests the problem is with the dialogOptions, If we look at the dialogOptions variable in the script above, it all looks good, but for some reason, it is not being set. If we look at the line above it:

Everything under this, in theory, should only run if the job is in colour. As a test, we sent another print job but this time selected black and white, and that was when we managed to reproduce the error.
There is a bit of a trick when it comes to if statements if you don’t surround everything with { } it will only apply to the one line under it which in this case is the line that sets the dialogOptions.

To fix this, we suggested putting an { on line 22 and add another } on line 47. Luckily this didn’t cause any actual problems for what they are using the script for as only B/W jobs would trigger the error but it is something to keep an eye on in the future.

While PaperCut comes with dozens of pre-written script recipes, we also provide a script creation service to our channel. If you have a requirement or have questions? Simply get in touch with your Account Manager.

Get in touch today | sales@selectec.com

 

 

 

Latest News from Jonathan Bennetts
img

How do you bulk delete printers in PaperCut?

We get asked fairly often if it's possible to quickly delete printers from Pap...

Written by: Jonathan Bennetts

More
img

Automate Balance Updates in PaperCut

A few days ago one of our resellers came to us with an interesting problem. T...

Written by: Jonathan Bennetts

More

img

Since we started working with selectec and using papercut 7 years ago we have found the product and the support team excellent, long may the relationship continue

Simon Riley Direct-tec
Back to Top ↑