gopher_1999 Posted September 17, 2019 Posted September 17, 2019 Hi I want to limit users to a certain number of pages per week. I also want it to be in gray scale. I have altered the setting on the printer to only print gray scale but the only script I can find is for color per day. Anyone know how to change it to gray scale per week? /* * Daily color page limit * * Sometimes, a high price tag just isn't enough to discourage users from * printing in color. This recipe imposes a fixed limit on the number of color * pages a user can print per day. * * Imposing a color page quota is a better solution than separate balances for * color and black & white. Separate balances are more confusing (two accounts * to manage) and also can lead to waste. The user may for example run out of * black and white credit, and therefore be forced to print in color wasting * resources. This method (an overlayed color quota) solves these issues. */ function printJobHook(inputs, actions) { // Modify this value to change the daily color page limit. var MAX_COLOR_PAGES_PER_DAY = 20; if (!inputs.job.isAnalysisComplete) { return; } if (!inputs.job.isColor) { // Not color so no need to check and apply any limits. return; } var currentColorCount = inputs.user.getNumberProperty("color-per-day"); if (currentColorCount == null) currentColorCount = 0; var currentDayIndex = inputs.job.date.toDateString(); var dayLastSeen = inputs.user.getProperty("color-day-last-seen"); if (dayLastSeen == null || dayLastSeen != currentDayIndex) { // It's a new day. Reset the current count value to zero. currentColorCount = 0; } currentColorCount += inputs.job.totalColorPages; if (currentColorCount > MAX_COLOR_PAGES_PER_DAY) { var deniedMessage = "This print job has been denied. You have exceeded" + " your daily limit of " + MAX_COLOR_PAGES_PER_DAY + " color pages per day. Please print in grayscale."; actions.client.sendMessage(deniedMessage); actions.job.cancelAndLog("This job was denied because you have exceeded" + " the daily color quota."); return; } // If we're here, then it's OK for the job to proceed. // Save the current daily count actions.user.onCompletionSaveProperty("color-day-last-seen", currentDayIndex); // Note: Set is used for simplicity (see "Rate limit by department" // for use of increment). actions.user.onCompletionSaveProperty("color-per-day", currentColorCount); }
Jawloms Posted September 17, 2019 Posted September 17, 2019 Why are you doing this via scripts? Can't you just give them credit which resets itself to (for example) £1 per week and charge them 5p per print?
Katy Posted September 17, 2019 Posted September 17, 2019 (edited) If you want to limit grayscale quantities then you'd just remove this line: if (!inputs.job.isColor) { // Not color so no need to check and apply any limits. [/color][color=#333333]return; [/color][color=#333333]}[/color] and to force it greyscale add in: [color=#004499][font=monospace]actions[/font][/color][color=#666666][font=monospace].[/font][/color][color=black][font=monospace]job[/font][/color][color=#666666][font=monospace].[/font][/color][color=black][font=monospace]convertToGrayscale[/font][/color][color=#666666][font=monospace]([/font][/color][color=#666666][font=monospace])[/font][/color][color=#666666][font=monospace]; [/font][/color] Edit: Give up trying to get it to format, stupid editor Edited September 17, 2019 by Katy
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