AlexB Posted June 5, 2017 Posted June 5, 2017 This came up at EdIT as a script used on printers controlled by PaperCut to encourage users to use the more cost effective copiers for bulk printing. Obviously, don't apply this script to the copiers too! The code comments should cover everything, but the main complication is that you need to store an image in \server\custom\web\treecutting_ani.gif of a suitable graphical message (I have an animated GIF of the lumberjack chopping down a tree). I'm afraid you'll have to find or make your own royalty free gif. There are a few other bits in the script, but I didn't remove them as I thought they might be of general interest. The main "lumberjack" code is between the hashtags function printJobHook(inputs, actions) { // Only does this if in the staff or technician group if (inputs.user.isInGroup("SBA4730_staff") || inputs.user.isInGroup("SBA4730_technicians")) { //Remove watermark for staff actions.job.setWatermark(""); //########################################################## // Checks if the PaperCut client is running (popups don't work without it) if (inputs.client.isRunning) { // waits for the job analysis to be completed. Colour, pages, etc... if (!inputs.job.isAnalysisComplete) { return; } // Setup variables var response = "OK"; var dialogOptions = { "dialogTitle":"Large print job detected", "dialogDesc":"Message from the Network Administrator" , "hideJobDetails":true, "timeoutSecs":60 }; if (inputs.job.totalSheets > 99) { // gif in \server\custom\web\ response = actions.client.promptForText("http://sba4730-ps:9191/custom/treecutting_ani.gifAs this is such a large print job we would like to request a brief description of what is being printed",dialogOptions ); } else if (inputs.job.totalSheets > 10) { // gif in \server\custom\web\ response = actions.client.promptPrintCancel( "http://sba4730-ps:9191/custom/treecutting_ani.gifThis job is larger than 10 pages. Are you sure you want to print this many pages?Please remember you can print directly to the photocopier ",dialogOptions ); } // If response was "OK" (comes from pressing the OK button, only from promptPrintCancel) if ( response == "OK") { // print } // If cancelled, timed out or user didn't bother filling in promptForText else if (response == "CANCEL" || response == "TIMEOUT" || response == "") { // ditch the job actions.job.cancel(); return; } else { // add the response from promptForText to the comment for the job and print actions.job.addComment(response); } } // if (inputs.client.isRunning) //########################################################## } // if (inputs.user.isInGroup("SBA4730_staff") || inputs.user.isInGroup("SBA4730_technicians")) // Forces the use of the Mono balance actions.job.changePersonalAccountChargePriority(['Mono']); } I went in this direction to avoid the accusation that I was preventing teachers from doing what they needed and still allowing them to use costly printers if they insisted. 1
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now