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

Grant temporary access to printers using PaperCut

How do I grant temporary access to company printers?   One of our rese...

Written by: Jonathan Bennetts

More
img

Peppermint Technology PaperCut Integration

Peppermint technology PaperCut integrations Selectec were approached by our ...

Written by: Jonathan Bennetts

More

img

Having dealt with Selectec for the past 8 years the service and support we get for PaperCut MF has been exceptional, support requests are met in a short timescale and dealing with the friendly and knowledgeable staff is always a pleasure

Phil Kelly Midshire Business Systems
This website works best using cookies which are currently disabled. We use cookies to help with our site analytics to improve our services.
Back to Top ↑