Example: Set a daily color copying quota for all users
-
Device scripting is currently in Percolator, so bear on mind that it will be refined before launch. If you have any feedback or recipe requests, check out the Project Myrtle Percolator page.
-
You can also use Print scripting to define and fine tune your printing policies.
SandComp is a large manufacturing company consisting of 3000 employees. They have noticed recently that their staff are doing a lot of color copying, and suspect a large portion of it was unnecessary. SandComp would like reduce their color copying costs by implementing a quota for how many color copy pages each user can do in one day. This will encourage staff to use Black & White.
Requirements
Using device scripting, SandComp will implement:
-
a maximum of 10 color copy pages per day per user.
Implementation
The best way to create a device script is to either start with a recipe or build your script using snippets. This example demonstrates how to use a recipe to create your script.
To create this script, you will:
You can also download the script here and then copy it into the Script Editor.
For more information about creating device scripts, see:
If you set up a daily quota limit, there is a way to override the limit for an individual or group if needed. For more information, see Working with Scripting Properties.
Import the Impose a daily color copy limit recipe
This script is based on a single recipe.
-
Click the Devices tab.
The External Device List page is displayed.
-
Select a test device.
The Device Details page is displayed.
IMPORTANTDevice scripts are applied as soon as you click Apply, so make sure you create your script on a test device
-
Click the Scripting tab.
-
Select the Enable device script checkbox.
-
Click Import Recipe.
-
Select the Impose a daily color copy limit recipe; then click import.
A message is displayed asking if you want to replace the existing script content. When you import a recipe, it replaces any existing content you have in your script. To combine multiple recipes, see Combining device scripts.
-
Click OK.
The script is added to the editor.
Customize the Impose a daily color copy limit recipe
This script consists of two functions:
-
deviceLoginHook—sets the daily color copy limit and resets the page count each day
-
deviceJobLogHook—logs the number of color copy pages per day
deviceLoginHook
The deviceLoginHook function includes the following:
-
a variable that specifies the maximum number of color pages allowed per day (see 1 in the image below).
-
variables that specifies how the number of color copy pages performed per user per day is calculated (see 2 in the image below).
-
an if statement (see 3 in the image below) that:
-
determines if the color copy page count needs to be reset, and if so, resets it.
-
-
an if statement (see 4 in the image below) that:
-
checks if the maximum number of color pages per day has been reached
-
if it has, performs the action of blocking the job.
-
In this example, SandComp want to impose a maximum of 10 color copy pages per day so you need to change the value of the maximum number of color copy pages allowed. You don't need to change any other lines in this function.
-
Change the MAX_COLOR_COPY_PAGES_PER_DAY variable value to 10 because SandComp want to impose a maximum of 10 color copy pages per day (see 1 in the image above).
-
Click Apply.
deviceJobLogHook
The deviceJobLogHook function includes the following:
-
an if statement (see 1 in the image below) that checks if the copy job is NOT color.
-
an action (see 2 in the image below) that analyzes the number of color pages for the job, and then updates the user's daily copy page count.
-
an action (see 3 in the image below) that saves the date on which the last color copy job was performed by the user.
In this example, you don't need to change any lines in this function.
Test your script and go live
Before you copy your script to production devices, make sure you check that it works in on a test device.
-
Check the following on a test device:
-
Perform a color copy job of 10 or more pages; then log out.
NOTEBecause this script is triggered on login, it cannot prevent color copying when the limit is reached during a session.
-
Try to perform another color copy job. You should not be able to.
-
On a different day, perform a color copy job of less than 10 pages to confirm that it still works.
-
-
Copy your device script to the required devices.