Tips for device scripting
-
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.
-
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 there are no errors when you click Apply does not mean it is bug free. Take time to test your script in all scenarios. For example, if your script applies a daily maximum number of color page copies, test it by trying to copy more than the maximum number in a day.
-
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 Device script API reference). Knowing what is possible can open up ideas.
-
Use actions.log.debug() to assist with debugging. This logs a message to the server's text-based log file ([app-path]/server/logs/server.log).
-
If your scripts interact with end users, perform some usability testing to ensure your users understand your messages and intentions.
-
When working with JavaScript remember:
-
If you copy and paste an existing line or element, make sure you check the commas.
-
Check that all ( ) and { } and [ ] match as expected.
-
Check that all lines within { } end with a semi-colon.
-
For more information about JavaScript, see w3schools JavaScript Tutorial, JavaScript Function Definitions, or JavaScript.com.
-