Tips for print scripts
-
Use snippets and/or recipes where possible. They are tested and demonstrate best practice.
-
Start out small and aim high. Don't try building your script all in one go. Write a bit, test, then move on. Large scripts written in one go are hard to debug.
-
Always test your scripts! Just because a script compiles does not mean it is bug free. Take time to test your script and exercise all logic paths. For example, if your script applies an action to jobs with more than 100 pages, test it by printing jobs that are both more and less than 100 pages.
-
Check all your scripts from time to time for runtime errors and/or enable error level event notifications to receive an email when errors occur (see Error level event notifications).
-
Take some time to explore the list of methods in the reference APIApplication Programming Interface (API) is a set of routines, protocols, and tools for building software and applications. An API expresses a software component in terms of its operations, inputs, outputs, and underlying types, defining functionalities that are independent of their respective implementations, which allows definitions and implementations to vary without compromising the interface. documentation (see Print script API reference). Knowing what is possible can open up ideas.
-
Use actions.log.debug() or actions.client.sendMessage() to assist with "print line" style debugging.
-
If your scripts interact with end users, perform some usability testing to ensure they understand your messages and intentions.
-
Consider using HTML markup to pretty up your dialog messages (see the snippetCode snippets are small code fragments that demonstrate how to use the scripting API (inputs, functions, and methods). titled Show a dialog with HTML formatting).
-
PaperCut MF 18.2.0 or above allows users to change the settings of held print jobs at the device. If you implement Advanced scripting (print scripting) that applies to these settings, then ensure to stop users from being able to change such settings at the device. For more information, see Changing attributes of print jobs at the device.