Download PaperCutTM

Transcript
Advanced Scripting (Print Scripting)
Method
Description
actions.log.error(message)
Logs an error message to the App. Log.
Parameters:
•
message (string) - the message to log.
Logs
a
message
to
the
server's
text-based
log
file
([app-path]/server/logs/server.log). This can be helpful to diagnose
problems with print scripts.
actions.log.debug(message)
Parameters:
•
message (string) - the message to log.
Table 18.9. Log Actions Script Reference (actions.log)
18.2.3.4. Utility Actions (actions.utils)
Method
Description
actions.utils.sendEmail(recipient, subject, body)
Sends an email to an email address or username.
Parameters:
•
recipient (string) - either the email address or username of the email
recipient.
•
subject (string) - subject text of the email.
•
body (string) - body text of the email.
Sends an email to one or many email addresses or usernames.
actions.utils.sendEmail(recipients, subject, body)
Parameters:
•
recipients (array of strings) - either the email addresses or usernames of
the email recipients.
•
subject (string) - subject text of the email.
•
body (string) - body text of the email.
Example: to send an email to many email addresses or usernames
actions.utils.sendEmail(
["Administrator", "support-staff@myuniversity.edu"],
"Oh no!", "we're out of print credit!");
actions.utils.onCompletionSaveProperty(propName,
options])
value[,
Saves a global value as a string associated with a persistent custom-defined
property. This operation is performed once the print script completes and the
print-job is printed.
Parameters:
•
propName (string) - the name/key of the property to set.
•
value (string) - the property value. Note: Numbers will be converted to a
string.
•
options (object/dictionary) - options to modify behavior of the command.
•
saveWhenCancelled (boolean) - If set to true, the operation is
performed even if the print job is cancelled (eg. insufficient credit). By
default, this is set to false.
For more information using storage properties see Section 18.2.4, “User
Defined Persistent Properties (Storage)”.
actions.utils.onCompletionIncrementNumberProperty(propName,
value[, options])
A convenience method to increment a global number value associated with a
persistent custom-defined property. This operation is performed once the print
script completes and the print-job is printed.
Parameters:
305
•
propName (string) - the name/key of the property to set.
•
value (number) - the amount to increment by. A negative number will
decrement.