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

Contents

Advanced Scripting: Conditionally Suppress Pop-up

THE PAGE APPLIES TO:

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

Comments

Last updated June 13, 2024