Print Scripting with Job Ticketing

KB Home   |   Print Scripting with Job Ticketing

Main.PrintScriptingWithJobTicketing History

Hide minor edits - Show changes to output

November 16, 2018, at 07:04 AM by Aaron Pouliot - Added category - Print Scripting
Changed line 163 from:
''Categories:'' [[Category.JobTicketing|+]], [[Category.Scripting|+]]
to:
''Categories:'' [[Category.JobTicketing|+]], [[Category.PrintScripting|+]]
July 26, 2018, at 09:47 AM by Jack Lawless - Added categories
Changed lines 161-163 from:
[-Keywords: Job Ticketing, Print Scripting -]
to:
[-Keywords: Job Ticketing, Print Scripting -]
----
''Categories:'' [[Category.JobTicketing|+]], [[Category.Scripting|+]
]
June 25, 2018, at 04:24 AM by Danielle Ko and Matthew Lee -
Changed line 141 from:
  }
to:
  )
Changed line 144 from:
  actions.user.onCompletionSaveProperty("displayed", "yes", {'saveWhenCancelled' : true})
to:
  actions.user.onCompletionSaveProperty("job-ticketing-displayed", "yes", {'saveWhenCancelled' : true})
Changed line 146 from:
   }
to:
   }}
June 19, 2018, at 07:02 AM by Danielle Ko and Matthew Lee - Added job ticketing logo to download
June 19, 2018, at 07:01 AM by Danielle Ko and Matthew Lee -
Changed lines 77-78 from:
2b. You can download and use this image for the pop up: //
to:
2b. You can download and use this image for the pop up:
Changed line 151 from:
2b. You can download and use this image for the pop up: //
to:
2b. You can download and use this image for the pop up:
June 19, 2018, at 07:01 AM by Danielle Ko and Matthew Lee -
Changed lines 75-76 from:
2. Add a custom image that will be displayed in the pop-up box, in the PaperCut NG/MF installation directory: [@<server>/custom/@] folder and adjust the script to reflect the name of the image.
to:
2a. Add a custom image that will be displayed in the pop-up box, in the PaperCut NG/MF installation directory: [@<server>/custom/@] folder and adjust the script to reflect the name of the image.

2b. You can download and use this image for the pop up: //

(:table border=1 width=100% cellspacing=5 class=issues :)
(:cellnr class=cnr :)
Attach:Job-Ticketing-Logo.png
(:tableend:)

Changed lines 149-156 from:
2. Add a custom image that will be displayed in the pop-up box, in the PaperCut NG/MF installation directory: [@<server>/custom/@] folder and adjust the script to reflect the name of the image.
to:
2a. Add a custom image that will be displayed in the pop-up box, in the PaperCut NG/MF installation directory: [@<server>/custom/@] folder and adjust the script to reflect the name of the image.

2b. You can download and use this image for the pop up: //

(:table border=1 width=100% cellspacing=5 class=issues :)
(:cellnr class=cnr :)
Attach:Job-Ticketing-Logo.png
(:tableend:)
June 18, 2018, at 07:53 AM by 90.152.8.32 -
Changed line 83 from:
Attach:JobTicketingCancelled.png
to:
Attach:JobTicketingDidYouKnow.png
June 17, 2018, at 11:37 PM by Danielle Ko and Matthew Lee - Created
June 17, 2018, at 11:36 PM by Danielle Ko and Matthew Lee -
June 17, 2018, at 11:33 PM by Danielle Ko and Matthew Lee - Created
Added lines 1-147:
(:title Print Scripting with Job Ticketing :)

If you've got Job Ticketing installed and running, there are a couple of handy print scripts that you can use to let our users know about this new exciting option for print submission and to ensure that print jobs are sent to your print rooms.

!!Cancel large jobs from printing and direct your users to Job Ticketing

This print script will stop users from printing over a specified number of pages. If the print job exceeds this number,  a pop-up box will be displayed with a link for the user to use Job Ticketing for their print job.

The admin can specify the maximum number of pages in this script.

Attach:JobTicketingCancelled.png

'''What do I need to do?'''

1. Copy and Paste the script below into PaperCut MF's advanced scripting area (for more info: https://www.papercut.com/support/resources/manuals/ng-mf/common/topics/script.html)

[@
/*
* Cancel large jobs with  a pop-up message to use Job Ticketing
*
* A user printing a large job is advised their job will be cancelled
* and they will need to use Job Ticketing
*/
function printJobHook(inputs, actions) {
 
  /*
  * This print hook will need access to all job details
  * so return if full job analysis is not yet complete.
  * The only job details that are available before analysis
  * are metadata such as username, printer name, and date.
  *
  * See reference documentation for full explanation.
  */
  if (!inputs.job.isAnalysisComplete) {
    // No job details yet so return.
    return;
  }
 
  var LIMIT            = 100; // Redirect jobs over 100 pages.
   
  if (inputs.job.totalPages > LIMIT) {
    /*
    * Job is larger than our page limit, we will cancel the job and ask the user to upload it to Job Ticketing
    * Send a message to the user to advise and include a link to the Job Ticketing Upload.
    * Note: Tailor this message to suit your use-case
    */
   
    var response = actions.client.promptOK(
      "<html>"
      + "<div style='width:400px; height:240px; padding: 10px; color:#FFFFFF; "
      + "    background-color:#00AE5A;'>"
      + "  <div style='padding: 10px; font-weight: bold; font-size: 18px; text-align: center;'>"
      + "    Print Policy Alert<br>"
      + "    <img src='http://%PC_SERVER%/custom/job-ticketing-logo.png'>"
      + "  </div>"
      + "  <div style='font-size: 10px; text-align: center;'>"
      + "  This print job is above the maximum number of pages"
      + "  that can be printed to <br>the Find Me print queue.<br><br>"
      + "  Please submit your document to Job Ticketing using the link below:<br><br>"
      + "  </div>"
      + "  <div style='font-size: 12px; font-weight: bold; text-align: center;'>"
      + "  <a href='http://localhost:9191/job-ticketing' style='color:white;text-decoration: none'><u>Job Ticketing</u></a><br>"
      + "  </div>"
      + "</div><br>"
      + "<div align='center'>"
      + "</div>"
      + "</html>",{'hideJobDetails': true, 'dialogTitle': "Your job has been cancelled", 'dialogDesc' : "Your print job has been cancelled, please see below for details"}); 
   
    actions.job.cancelAndLog("Job exceeded maximum number of pages. Cancelled, user directed to Job Ticketing.");
    return;
  }
}
@]

2. Add a custom image that will be displayed in the pop-up box, in the PaperCut NG/MF installation directory: [@<server>/custom/@] folder and adjust the script to reflect the name of the image.

3. Check that the script correctly references the URL for your Job Ticketing environment.

!!One time pop up to let users know about Job Ticketing

If your organization is new to Job Ticketing, this is a print script that you can use to let users know they can now use Job Ticketing to submit their jobs. This pop up appears only when the User Client is actively running and once users dismiss the pop-up message, it will not be displayed again.

Attach:JobTicketingCancelled.png

'''What do I need to do?'''

1. Copy and Paste the script below into PaperCut MF's advanced scripting area (for more info: https://www.papercut.com/support/resources/manuals/ng-mf/common/topics/script.html)

[@
/*
* Display a one-off message to users to let them know about Job Ticketing
*/
function printJobHook(inputs, actions) {
 
  /*
  * This print hook will need access to all job details
  * so return if full job analysis is not yet complete.
  * The only job details that are available before analysis
  * are metadata such as username, printer name, and date.
  *
  * See reference documentation for full explanation.
  */
  if (!inputs.job.isAnalysisComplete) { return; }
 
  // Get the current value of the user property "job-ticketing-displayed" and write to variable "viewed"
  var viewed = inputs.user.getProperty("job-ticketing-displayed");
 
  // If viewed is null, then the key doesn't exist
  if (viewed == null) {
    // Display message to user
    actions.client.promptOK(
     
      "<html>"
      + "<div style='width:400px; height:260px; padding: 10px; color:#FFFFFF; "
      + "    background-color:#00AE5A;'>"
      + "  <div style='padding: 10px; font-weight: bold; font-size: 18px; text-align: center;'>"
      + "    Did you know?<br>"
      + "    <img src='http://%PC_SERVER%/custom/job-ticketing-logo.png'>"
      + "  </div>"
      + "  <div style='font-size: 10px; text-align: center;'>"
      + "  Did you know we now have a new way for you to submit jobs via Job Ticketing?<br><br>"
      + "  With Job Ticketing you can submit your print jobs"
      + "  and keep track of your previous orders.<br><br>"
      + "  Click the link below to login and check it out now.<br><br>"
      + "  </div>"
      + "  <div style='font-size: 12px; font-weight: bold; text-align: center;'>"
      + "  <a href='http://localhost:9191/job-ticketing' style='color:white;text-decoration: none'><u>Job Ticketing</u></a><br>"
      + "  </div>"
      + "</div><br>"
      + "<div align='center'>"
      + "</div>"
      + "</html>",{'hideJobDetails': true, 'dialogTitle': "Did you know?", 'dialogDesc' : "Your print job has been sent, but have you heard about Job Ticketing?"})
   
  }
 
  // Set the property against the user when job is completed (even if it was cancelled). This stops the message being displayed again.
  actions.user.onCompletionSaveProperty("displayed", "yes", {'saveWhenCancelled' : true})
   
    }
@]

2. Add a custom image that will be displayed in the pop-up box, in the PaperCut NG/MF installation directory: [@<server>/custom/@] folder and adjust the script to reflect the name of the image.

3. Check that the script correctly references the URL for your Job Ticketing environment.

----
[-Keywords: Job Ticketing, Print Scripting -]

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:04 AM
Printable View   |   Article History   |   Edit Article