Advanced Scripting: Conditionally Suppress Pop-up
Contents
In education and corporate firms, it is very common to use account selection popups. It allows users to select the account they want to print to.
These organizations also do not want to annoy their users with an unnecessary number of pop-ups and instead only want to track jobs over a certain page count, or dollar amount. For example: Do not display shared account selection popup if the number of pages is less than 10 and charge to personal account. This can be achieved by using Advanced Scripting.
Scripts are available under Printers → [Name of the printer] → Scripting
. These scripts are very useful when such customization need to be implemented. This feature makes PaperCut a powerful tool and can be customized to meet requirements of different organizations.
The account selection popups are displayed before the analysis is even complete which is what makes it tricky to suppress the popup. To be able to do this there is a small trick will you need to follow. You will need to add “actions.job.chargeToPersonalAccount();”
to the section where analysis is not complete.
actions.job.chargeToPersonalAccount()
is an API that is used to disable any client popups and account selection, and to charge the job to the user’s personal account.
See the script below:
function printJobHook(inputs, actions) {if (!inputs.job.isAnalysisComplete) {
actions.job.chargeToPersonalAccount(); return;
}
if (inputs.job.totalPages < 10) { // Charge to the personal account actions.job.chargeToPersonalAccount(); // Or maybe charge to a single shared account } // Account Selection will still show }
Categories: How-to Articles , Notifications , Scripting and APIs
Keywords: customizing , Print Scripting , display popup
Last updated June 13, 2024
Comments