Choose your language

Choose your login

Support

How can we help?

Lightbulb icon
Lightbulb icon

Here’s your answer

Sources:

Lightbulb icon

Oops!

We currently don’t have an answer for this and our teams are working on resolving the issue. If you still need help,
User reading a resource

Popular resources

Conversation bubbles

Contact us

Device scripting overview

This page applies to:

Device scripts are segments of code that are run when either a user logs in to a device, a print job is released at the device, or a copy, scan, or fax job has been completed.

Why use Device Scripting?

Have you ever been asked to introduce color page quotas or to restrict who has access to color copying? Maybe the existing pricing structure that you use doesn’t give you the flexibility that you need?

PaperCut MF’s Device Scripting interface is a powerful and flexible feature that you can use to define and fine-tune your user’s experience at the MFD.

Device Scripting allows you to implement copy, scan, and fax policies (such as limiting color copying) that will change user behavior at the MFD, saving your organization money and of course, helping the environment. You can also use these policies to implement differential charging based on various factors such as the time of day, the account being charged, or the user performing the job.

At a high level, device scripts provide the ability to:

  • adapt logic based on copy, scan, and fax job attributes such as cost, pages, document name, time, etc.
  • modify job attributes and behavior such as limiting color page copies, or having a different cost model for different user groups.

While there are many features you can enable or change in the Admin web interface, scripting your own behavior introduces a whole new level of customization.

Common uses for device scripting

The functionality available via scripting is varied and is constantly being extended based on customer demand. Some common uses include:

  • block access to devices based on day/time (for example, block access to devices on weekends)
  • set a daily color copy quota
  • prevent copying entirely for users in a selected group
  • prevent color copying during peak periods or completely
  • discount copying and scanning for certain user groups (for example, staff )
  • charge a different pricing model for different user groups
  • allow free copying during certain periods
  • offer a discount during off-peak hours
  • exempt specific users from color copy restrictions

Device scripts are JavaScript

All of the above are possible by writing a small JavaScript directly into a code editor in the admin interface. In fact, the above functionality is provided as pre-built recipes ready to use, just like you can with Print scripting . Alternatively, you can build your own scripts to suit your organization’s needs.

All of PaperCut MF’s advanced scripts are written using JavaScript (also known as ECMA-262 ECMAScript… apparently). For more information about JavaScript, see:

The script is defined using the concept of “hooks”. A hook is a JavaScript function (for example, function deviceLoginHook(inputs, actions) { }) that determines when in the job workflow the script will run. Your device script defines this method, its behavior, and its actions. Your device script can have one or more hooks, depending on what you want to achieve

All scripts are defined on a per-device basis allowing each device to have its own logic. You can also share/copy a common script between devices by either Copying printer settings or using a common script .

Previous experience with scripting or programming is strongly recommended. However, PaperCut MF does provide a number of tools to assist with script development, including:

  • a mini JavaScript editor with basic error checking and syntax highlighting
  • quick access to a code cookbook containing dozens of best-practice recipes
  • pre-canned “code snippets” demonstrating the use of key functions
  • simple debugging tools such as logging and runtime error reporting.

Configuration topics

For more information about creating device scripts, see:

Comments