PaperCut Print Script

PaperCut Print Script of the Month #8 – Disable Print Archiving

PaperCut Print Script of the month

 

This month we’re going to look at how we can use a PaperCut Print Script to try and fire Ross again, last time we tried he found out a bit early by looking at the print archives, this time, we have created a script so HR can opt to disable print archiving for jobs that they believe are sensitive. To find out how we did this grab a cup of coffee and continue reading.

After looking through the Print Script API documentation, I noticed a useful method: actions.job.disableArchiving(), This will allow us to disable the archiving so that sensitive or confidential documents are not viewable by other users.

archiving_disabled

 

To start setting this up we are going to create three variables one for the group, one for the message to show in a pop-up and the last one will contain the message to show as a job comment.

var GROUP = "HR";
var MESSAGE = "Do you want to disable archiving for this job?";
var COMMENT = "This job was considered sensitive and archiving was disabled";

 

Next we need to check if the user is in the group we have set in the variable and display a popup box. There a few different types of popup box we can create which will be covered in future articles. For this month we are only interested in a simple Yes or No box. We will also need to use the response from the box in the script so we will need to set it to a variable.

if (inputs.user.isInGroup(GROUP)) {
    var RESP = actions.client.promptYesNo( MESSAGE );
    // More code will follow
}

 

After that we now have a window that will pop up when a user in the HR group prints it should look something like this:

sotm_8_pop_up

At the moment it doesn’t matter what option is selected as we are not checking the response, The first one we will want to check is if they click Yes the value that will be returned is YES so it will just be a simple case of checking to see if RESP matches that value. We will also want to add the actions.job.disableArchiving() method and provide a handy comment to go along with the job so we can see why there is no archived copy of the job this is done using actions.job.addComment().

if (RESP == "YES"){
    actions.job.disableArchiving();
    actions.job.addComment(COMMENT);
    return;
}

 

The only thing left to do now is deal with nothing being pressed this is referred to as TIMEOUT, We are not bothered with what happens when they click No as we just want the job to print out like normal, so we don’t need to set anything for it.

if (RESP == "TIMEOUT") {
    actions.job.cancel();
    return;
}

 

That is it for this month and as always the complete print script is below and don’t worry we didn’t let anyone go in the making of this script.

 

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

 

/*
* Allow a group of users to disable Archiving
*
* Read more at http://selectec.com/script-of-the-month-8-disable-print-archiving/
*/
function printJobHook( inputs, actions ) {

    var GROUP = "HR";
    var MESSAGE = "Do you want to disable archiving for this job?";
    var COMMENT = "This job was considered sensitive and archiving was disabled";

    if (!inputs.job.isAnalysisComplete) {
        return;
    }

    if (inputs.user.isInGroup(GROUP)) {
        var RESP = actions.client.promptYesNo( MESSAGE );

        if (RESP == "TIMEOUT") {
            actions.job.cancel();
            return;
        }

        if (RESP == "YES"){
            actions.job.disableArchiving();
            actions.job.addComment(COMMENT);
            return;
        }
    }
}