img

PaperCut Print Script of the Month #2 – Days until Christmas


PaperCut Print Script – Days until Christmas

 

It is almost that time of year again where we get some time off work and eat until we nearly explode and watch whatever James Bond film happens to be on the TV. This month we are going to create a PaperCut Print Script to tell the users how many days there are to go until the big day, so grab a cup of coffee or tea and let’s begin.

We begin our script this month by creating a new Date object this will make it easier to work with dates which are usually done by converting the date to a number and working from there, this is called Unix Time or POSIX / Epoch Time.

Next up is to set the date we want to use for our countdown and convert it to Unix Time using the Date.parse() method and also set a variable to today’s date that we will use later.

So now we need to do a little bit of math to work out what difference is between today and 25th December then convert it to a number that will actually mean something to a user and also round it to the nearest whole number.

All we need to do now is add in a few if statements to handle the three possible outcomes, then send the user a message that is relevant. We only have three possible cases to take into consideration here; Christmas has not yet happened, Christmas has happened and today is Christmas (We don’t recommend working on Christmas day unless something important is on fire).

That is it now you have a script you can use to let your users know how many days there are until Christmas, you could restrict this to certain groups of users or even use it to remind people of any events you have coming up.

As always the complete print script is below and 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

PaperCut Print Script
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

We have worked with Selectec for a number of years now and they are the perfect PaperCut partner for us. The support team is fantastic and knowledgeable and the sales staff are superb. With the high level of service we get from Selectec we have no reason to consider using anyone else.

Martin Croft Direct-tec Group Ltd
Back to Top ↑