Displaying a One Off Popup using Advanced Scripting

KB Home   |   Displaying a One Off Popup using Advanced Scripting

Main.OneOffPopupScript History

Hide minor edits - Show changes to output

November 16, 2018, at 07:07 AM by Aaron Pouliot - Added category - Print Scripting
Changed line 36 from:
''Categories:'' [[Category.Scripting|+]], [[Category.TipsAndTricks|+]]
to:
''Categories:'' [[Category.PrintScripting|+]]
Changed line 31 from:
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 script is displayed. Find out more about deploying the client  [[https://www.papercut.com/products/ng/manual/clienttool/topics/user-client-install-windows.html |here]]
to:
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  [[https://www.papercut.com/products/ng/manual/clienttool/topics/user-client-install-windows.html |here]]
Changed line 13 from:
to:
(:youtube Xzt_n3Rex1Y:)
Changed line 27 from:
** @@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.
to:
** @@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.
Changed line 27 from:
** @@img src=@@ [[<<]]This points to the image we are displaying in the popup. Copy your image to the @@..\server\custom directory@@ on your PaperCut server and simply edit the file name @@calendar_clock.png@@ to select your image.
to:
** @@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.
Deleted lines 34-36:

TODO link your page here: https://www.papercut.com/kb/Main/Miscellaneous

Changed line 36 from:
''Categories:'' [[Category.TODOFirstCategory|+]], [[Category.TODOSecondCategoryIfNeeded|+]]
to:
''Categories:'' [[Category.Scripting|+]], [[Category.TipsAndTricks|+]]
Changed line 38 from:
[-Keywords: TODO keywords here if needed-]
to:
[-Keywords: Advanced Scripting, Popups, Maintenance, Upgrades-]
Changed lines 9-10 from:
Let's start with the script. Use the link [[Attach:OneOffPopupScript.txt |Here]] to download the sample script.
to:
Let's start with the script. Use the link [[Attach:OneOffPopupAdvancedScript.txt |Here]] to download the sample script.
Changed line 22 from:
# 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)@@
to:
# 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.)
Changed line 17 from:
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 FindMe Print queue for your users this is a great place to start.
to:
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.
Changed line 1 from:
(:title Displaying a One-Off Popup using Advanced Scripting:)
to:
(:title Displaying a One Off Popup using Advanced Scripting:)
Added lines 1-41:
(:title Displaying a One-Off Popup using Advanced Scripting:)

The [[https://www.papercut.com/products/ng/manual/common/topics/script.html |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.

Attach:it_announcement_script.png

Let's start with the script. Use the link [[Attach:OneOffPopupScript.txt |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 FindMe 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.

# 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)@@
# 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 directory@@ on your PaperCut server and simply edit the file name @@calendar_clock.png@@ to select your image.
** @@<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='https://www.papercut.com' 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 @@https://www.papercut.com@@ 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 script is displayed. Find out more about deploying the client  [[https://www.papercut.com/products/ng/manual/clienttool/topics/user-client-install-windows.html |here]]

Now just think of the possibilities......


TODO link your page here: https://www.papercut.com/kb/Main/Miscellaneous

----
''Categories:'' [[Category.TODOFirstCategory|+]], [[Category.TODOSecondCategoryIfNeeded|+]]
----
[-Keywords: TODO keywords here if needed-]

Comments

Share your findings and experience with other PaperCut users. Feel free to add comments and suggestions about this Knowledge Base article. Please don't use this for support requests.

Article last modified on November 16, 2018, at 07:07 AM
Printable View   |   Article History   |   Edit Article