Choose your language

Choose your login

Contact us

Contents

Displaying a One Off Popup using Advanced Scripting

THE PAGE APPLIES TO:

Contents

The Advanced Scripting capabilities within PaperCut NG and PaperCut MF offer a whole host of options for making your users more aware of their printing and helping you reduce your overall print cost. However, Advanced Scripting also allows you to think outside of the box and use it to show one-off messages to your users.

In this example, we are going to setup a script to alert users to upcoming IT Maintenance. Users will see this pop up when they print, but once dismissed it will not be displayed again. Here’s a screenshot of our final result.

Let’s start with the script. Use the link Here to download the sample script.

Check out our video below which walks through this script and the setup once you have it downloaded.

We’ve also included some details below to help with the setup in addition to the video:

Once downloaded, you need to decide which printers you wish this script to affect. Therefore deciding which queue the users will need to print to for them to see the popup. If you are using a Find Me Print queue for your users this is a great place to start. From your PaperCut Admin Interface jump to Printers > Your chosen print queue > Advanced Scripting. Enable the option and paste the contents of the text file into the window.

You can now perform some customization to get the look and feel you are after. All of these will make sense when you compare the screenshot above to the script.

  1. Look for the section // Set variables and then the line var dEndDate
    This allows you to set your expiry date for the pop up in the format:
    new Date(year, month, day, hours, minutes, seconds, milliseconds). (JavaScript counts months from 0 to 11. January is 0. December is 11.)
  2. Next up scroll down to the section // Display HTML message to user.. This allows you to edit the HTML that is being used to present the pop-up. You can customize this to your liking, here are a couple of areas to check out.
    • <div style=‘width:400px; height:290px
      This allows you to set the width and height of the central notification area of the pop up.
    • background-color:#8DC63F
      This allows you to set the background color of the pop-up window.
    • <div style=‘padding: 10px; font-weight: bold; font-size: 18px; text-align: center;’>
      This sets the text formatting for the title of the popup. In this case Scheduled Maintenance.
    • img src=
      This points to the image we are displaying in the popup. Copy your image to the ..\server\custom\web directory on your PaperCut server and simply edit the file name calendar_clock.png to select your image. My image is 120px square, so be careful not to make yours too large.
    • <div style=‘font-size: 10px; text-align: center;’>
      This line and the following 5 lines allow you to setup the format and your own text message that the users will see in the popup.
    • <a href=‘<a href="https://www.papercut.com" reseed-ignore class="urllink">https://www.papercut.com</a>’ style=‘color:white;text-decoration: none’><u>Support Portal</u></a><br>
      This allows you to add a link for the users to click into the pop-up. The <a href="https://www.papercut.com" reseed-ignore class="urllink">https://www.papercut.com</a> is the actual path you wish to direct them to, which Support Portal are the words the user will actually see displayed.
    • ‘dialogTitle’: “IT Announcement”, ‘dialogDesc’ : “Scheduled maintenance is coming up. Check out the details below.”
      Finally this section allows you to set the title of the dialogue box and the description that appear at the top of the pop-up.

Once you have made your adjustments you are good to go, just don’t forget your users need to have the client software running at all times to make sure the popup is displayed. Find out more about deploying the client here

Now just think of the possibilities……


Categories: How-to Articles , Notifications , Scripting and APIs


Keywords: Advanced Scripting , Popups , Maintenance , Upgrades

Comments

Last updated March 15, 2024