img

PaperCut Print Script of the Month #1 – Halloween Trick


Welcome to the first PaperCut Print Script of the month

As Halloween is approaching I’ve decided to take to the Selectec tradition of picking on Ross online. This month we will be creating a simple PaperCut print script which will cancel or double the cost of his print jobs depending on what second his job was sent. So, grab a cup of coffee and we can start when you’re ready.

 

So, the first thing we are going to do is create two variables, one for the user we are going to target and another to hold the seconds from the time the job was sent. Creating a variable is nice and easy in Javascript we just come up with a name that we can remember or easily recognise later and assign it a value.

 

Our second variable is going to use the inputs.job.date method, and the seconds from the time the job was submitted.

 

Now that we have the variables we need let’s build out our if block. To make sure Ross has a hard time, we are only going to run the script if the job was submitted using his username using the inputs.job.username method. This could also be changed to a group of users by using inputs.user.isInGroup(group_name_variable).

 

Now inside that if block we are going to add another if block to compare the second’s value against 2 numbers so if seconds is 11 or seconds is 22 we are going to cancel the job and send a message back to him to tell him it has been cancelled.

 

It wouldn’t be fun if we just left it like that, so let’s add another if using else if to check if seconds is 33 or 44 and if it is we are going to double the cost of his job and leave a comment in the job log so we know what happened.

 

Now, we can end this with an else to catch anything else and leave it blank in an attempt to make him think it’s just random. We could of course use actions.job.convertToGrayscale() to convert the other jobs to Grayscale if we wanted to, but that might give away the game.

 

That is it! You’ve made it to the end of the first monthly script, and hopefully you have some ideas of what you could do in your environment for a little bit of fun. The full script is below and if you have any ideas for a future script get in touch and let us know.

If you have your own requirements for a PaperCut 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

PaperCut Print Script
Latest News from Paul Williams
img

Solving print job problems

Life in the trenches of support can be rewarding, no one gets a support gig wit...

Written by: Paul Williams

More
img

Foldr V4 Updates for February

The talented Foldr development team has been busy pushing out the next roun...

Written by: Paul Williams

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
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 ↑