img

PaperCut Print Script of the Month #9 – Everyone has an opinion


Topical and political for this month’s Advanced PaperCut Print Script

The Selectec pre-sales team came up with an interesting idea to use PaperCut to record people’s opinions and not just their print & copy history. The how will be explained below, the why is anyone’s guess, but grab your coffee and let’s jump in.

 

sotm_prompt

 


 

The first part of this is just setting variables as we have done before so we will set the Title for the pop-up window, the question to ask and the choices the user can pick from.

 

Now for something new we are going to set some options for the prompt which will help us hide the job details and set the default choice.
If you wanted to change the default option to something else you can modify the value that has been set for defaultChoice but you need to make sure it exists in your list of options.

 

With the setup out of the way, all we need to do is show the prompt and then save the results so we can view them. When showing the prompt we will need to make sure we set the response to a variable, so we know what option has been selected.
This is a bit different to how we would normally create a prompt as we are not setting the text to display. Instead, we are simply using the Title and Description fields established in the options above.  If you did wish to include extra text you can put it between the two ‘.

 

We now know what the user has selected and the result is saved in the “vote” variable. We could use a bunch of “if statements” and have one for each possible choice. We could then base our action on the response but as we know that the end goal is to increase a counter by 1 we can use a “for loop” to go over each of the choices until we have a match.

 

To save the votes, we will use the actions.utils.onCompletionIncrementNumberProperty() method that we used a couple of months ago to track virtual queue usage, but we are going to dynamically set the property by using ‘vote.’ + vote this will then give us the custom property script.user-defined.vote.[USERS-CHOICE] that we can search for in the config editor by using the ‘vote.’ prefix.

 

That is it for this month and as always the complete Advanced PaperCut Print Script is below.

If you have your own requirements for an Advanced 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 getting in touch with our sales team.

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

Ben and the support team have always been on hand to assist when we have needed to call on them

Owen Booty Canotec
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 ↑