Print Scripting with Mobility Print

KB Home   |   Print Scripting with Mobility Print

Main.PrintScriptingwithMobility History

Hide minor edits - Show changes to output

November 16, 2018, at 07:03 AM by Aaron Pouliot - Added category - Print Scripting
Changed line 52 from:
''Categories:'' [[Category.MobilityPrint|+]]
to:
''Categories:'' [[Category.MobilityPrint|+]], [[Category.PrintScripting|+]]
October 24, 2018, at 11:37 PM by Aaron Pouliot - monospaced file paths
Changed line 10 from:
#Open the file mobility-print-conf.toml in a text editor and add this line [=EnableDocumentNamePrefix=] = true”.
to:
#Open the file  '''mobility-print-conf.toml''' in a text editor and add this line @@[=EnableDocumentNamePrefix=] = true@@.
October 24, 2018, at 11:37 PM by Aaron Pouliot - monospaced file paths
Changed line 9 from:
#On your Mobility Print server, navigate to [app-directory]/PaperCut Mobility Print/data/config. In Windows, this path will be  “C:\Program Files (x86)\PaperCut Mobility Print\data\config\
to:
#On your Mobility Print server, navigate to @@[app-directory]/PaperCut Mobility Print/data/config@@. In Windows, this path will be  @@C:\Program Files (x86)\PaperCut Mobility Print\data\config\@@.
October 08, 2018, at 03:41 AM by Aaron Pouliot - fixed typo
Changed lines 3-4 from:
!!Does the Print Script API with Mobility Print?
Of course! It just takes one simple step to get this up and going before you can start scripting away.  Below we explain the steps to take, and provide a sample script to get you started.
to:
!!Can you use PaperCut's Print Scripting with Mobility Print?
Of course! It just takes one simple step to get this up and going before you can start using Mobility Print in tandem with PaperCut's versatile [[https://www.papercut.com/support/resources/manuals/ng-mf/common/topics/script.html|Print Scripting]] utility.  Below we explain the steps to take and provide a sample script to get you started.
June 04, 2018, at 03:32 PM by Mel Zouzoulas - Added link to the Mobility Print help center = good SEO
Added lines 48-49:

For more information about Mobility Print, check out the [[https://www.papercut.com/products/ng/mobility-print/manual/| Mobility Print Help Center]].
May 30, 2018, at 06:55 PM by Aaron Pouliot -
Changed line 17 from:
Use the example script below to automatically charge to the user’s personal account (instead of showing an account selection popup) when a job comes from any Mobility Print source.  Remove [@'mp:macos'@] and [@'mp:windows'@] if these devices are actually running the PaperCut Client.
to:
Use the example script below to automatically charge to the user’s personal account (instead of showing an account selection popup) when a job comes from any Mobility Print source.  Remove [@'mp:macOS'@] and [@'mp:windows'@] if these devices are actually running the PaperCut Client.
May 29, 2018, at 08:38 PM by Aaron Pouliot - fixed capitalization on macOS
Changed line 27 from:
  var MOBILITY = [ 'mp:iOS', 'mp:macos', 'mp:windows', 'mp:chrome', 'mp:android'];
to:
  var MOBILITY = [ 'mp:iOS', 'mp:macOS', 'mp:windows', 'mp:chrome', 'mp:android'];
May 29, 2018, at 06:17 AM by peterf - Not 100% sure but a customer reported str.match was case sensitive, so changed 'mp:ios' to 'mp:iOS'
Changed line 27 from:
  var MOBILITY = [ 'mp:ios', 'mp:macos', 'mp:windows', 'mp:chrome', 'mp:android'];
to:
  var MOBILITY = [ 'mp:iOS', 'mp:macos', 'mp:windows', 'mp:chrome', 'mp:android'];
May 16, 2018, at 04:22 PM by Aaron Pouliot -
Changed line 16 from:
!!Suppress the Account Selection Popup and charge to the Personal Account
to:
!!Suppress the Account Selection Popup with Mobility Print
May 16, 2018, at 04:19 PM by Aaron Pouliot -
Changed line 16 from:
!!Automatically charge to the Personal Account
to:
!!Suppress the Account Selection Popup and charge to the Personal Account
May 16, 2018, at 04:14 PM by Aaron Pouliot - script was missing Android
Changed lines 16-18 from:
!!Automatically charge to Personal Account
Use the example script below to automatically charge
to the user’s personal account (instead of showing an account selection popup) when a job comes from any Mobility Print source.
to:
!!Automatically charge to the  Personal Account
Use the example script below
to automatically charge to the user’s personal account (instead of showing an account selection popup) when a job comes from any Mobility Print source.  Remove [@'mp:macos'@] and [@'mp:windows'@] if these devices are actually running the PaperCut Client.
Changed line 27 from:
  var MOBILITY = [ 'mp:ios', 'mp:macos', 'mp:windows', 'mp:chrome', 'mp:chrome'];
to:
  var MOBILITY = [ 'mp:ios', 'mp:macos', 'mp:windows', 'mp:chrome', 'mp:android'];
May 16, 2018, at 03:57 PM by Aaron Pouliot -
Changed line 43 from:
}​
to:
}
May 16, 2018, at 03:57 PM by Aaron Pouliot -
Changed line 23 from:
   actions.job.chargeToPersonalAccount();
to:
   actions.job.chargeToPersonalAccount();
Added line 26:
  // Automatically charge all Mobility Print jobs to a users personal account 
Changed lines 28-30 from:
 // Automatically charge all Mobility Print jobs to a users personal account 
if (matchesAny(inputs.job.documentName,
MOBILITY)){
 
to:
  if (matchesAny(inputs.job.documentName, MOBILITY)){
Changed line 43 from:
}
to:
}​
May 16, 2018, at 03:54 PM by Aaron Pouliot -
Changed line 44 from:
}​
to:
}
May 16, 2018, at 03:53 PM by Aaron Pouliot - Fixed the script to include the matchesAny function
Added lines 21-25:
  // Hold the job until analysis is complete
  if (!inputs.job.isAnalysisComplete) {
  actions.job.chargeToPersonalAccount();
    return;
  }
Changed lines 27-28 from:
  if (matchesAny(inputs.job.documentName, MOBILITY)){
    // Automatically charge all Mobility Print jobs to a users personal account
to:
 // Automatically charge all Mobility Print jobs to a users personal account 
if (matchesAny(inputs.job.documentName, MOBILITY)){
 
Deleted line 30:
   return;
Added lines 33-44:
// Define the matchesAny function
function matchesAny(str, matchStrs, actions) {
  if (str == null || matchStrs == null) {
    return false;
  }
  for ( var i in matchStrs) {
    if (str.match(matchStrs[i])) {
      return true;
    }
  }
  return false;
}​
May 15, 2018, at 06:13 PM by Aaron Pouliot - fixed typos in script (illegal characters)
Changed lines 19-25 from:
[@function printJobHook(inputs, actions) {
var MOBILITY = [ 'mp:ios', 'mp:macos', ‘mp:windows', ‘mp:chrome’, ‘mp:chrome'];
if
(matchesAny(inputs.job.documentName, MOBILITY)){
// Automatically charge all Mobility Print jobs to a user's personal account
actions.job.chargeToPersonalAccount();
return;
} @]
to:
[@
function printJobHook(inputs, actions) {
  var MOBILITY = [ 'mp:ios', 'mp:macos', 'mp:windows', 'mp:chrome', 'mp:chrome'];
  if
(matchesAny(inputs.job.documentName, MOBILITY)){
    // Automatically charge all Mobility Print jobs to a users personal account
   actions.job.chargeToPersonalAccount();
    return;
  }
}

@]
April 30, 2018, at 05:59 PM by Aaron Pouliot - Added Category MobilityPrint
Added lines 30-31:
----
''Categories:'' [[Category.MobilityPrint|+]]
April 12, 2018, at 11:56 PM by Aaron Pouliot -
Changed line 3 from:
!!Can you use the PaperCut Print Script API with Mobility Print?
to:
!!Does the Print Script API with Mobility Print?
April 12, 2018, at 11:49 PM by Aaron Pouliot -
April 12, 2018, at 11:49 PM by Aaron Pouliot -
Changed line 10 from:
#Open the file mobility-print-conf.toml in a text editor and add this line “EnableDocumentNamePrefix = true”.
to:
#Open the file mobility-print-conf.toml in a text editor and add this line “[=EnableDocumentNamePrefix=] = true”.
April 12, 2018, at 11:44 PM by Aaron Pouliot -
Added lines 1-31:
(:title Print Scripting with Mobility Print:)

!!Can you use the PaperCut Print Script API with Mobility Print?
Of course! It just takes one simple step to get this up and going before you can start scripting away.  Below we explain the steps to take, and provide a sample script to get you started.

!!Enable the Document Name Prefix
Before starting, you will need to follow these steps so that PaperCut can identify which jobs are from Mobility Print.
 
#On your Mobility Print server, navigate to [app-directory]/PaperCut Mobility Print/data/config. In Windows, this path will be  “C:\Program Files (x86)\PaperCut Mobility Print\data\config\”
#Open the file mobility-print-conf.toml in a text editor and add this line “EnableDocumentNamePrefix = true”.
#Save the document.
#Finally restart the Mobility Print service for the changes to take effect.
 
Now any jobs submitted via Mobility Print the document name will be prefixed with (mp:<source>) where source is one of iOS, macOS, windows, android, chrome or unknown. Administrators can use this value in their scripts to extract client type.

!!Automatically charge to Personal Account
Use the example script below to automatically charge to the user’s personal account (instead of showing an account selection popup) when a job comes from any Mobility Print source.

[@function printJobHook(inputs, actions) {
var MOBILITY = [ 'mp:ios', 'mp:macos', ‘mp:windows', ‘mp:chrome’, ‘mp:chrome'];
if (matchesAny(inputs.job.documentName, MOBILITY)){
// Automatically charge all Mobility Print jobs to a user's personal account
actions.job.chargeToPersonalAccount();
return;
} @]

!!Still have questions?
Let us know! We’re definitely happy to chat about what’s going on under the hood. Feel free to leave a comment below if you have any questions at all or visit our Support Portal for further assistance.

----
[-Keywords: Mobility Print, Print Scripting, Print Script API, Account Selection]

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