Specifications

DescriptionVariable
The empty string: each output file is moved along the outgoing
connection as a separate job
The desired name of the job folder: all output files are placed
inside a single job folder with the specified name
If an error occurred during the execution of an earlier stage, or while
preparing for the execution of this stage, this variable contains an
$error
appropriate error message: otherwise its value is null (NOT the empty
string; an empty string signifies that an error indeed occurred but
no meaningful error message was generated -- this is considered
bad practice but it may happen)
If your script encounters an error, it should set the $error variable to
the appropriate error message (that is, a non-empty string);
otherwise it should leave the $error variable alone.
Error handling
Here's a typical coding pattern to correctly handle errors in a user script attached to the command
action:
if ($error == null)
{
try
{
// statements to be executed by this script
// $doc.ApplicationDependentFunction();
}
catch( e )
{
$error = e.description;
$doc.closeDoc( Application Specific Parameters );
// close any other resources used in the try block
} if
}
Here's a typical coding pattern to correctly handle errors for Adobe Acrobat application:
// Acrobat is used to make a summary of the annotations resulting in a file that shows you
the page
// content and the annotations per page.
// No arguments are required.
if($error == null)
{
try
{
var title = $doc.documentFileName + " summary"
$outfile = $outfolder + '/' + $filename + "_summary.pdf";
$doc.ANsummarize($doc, title, ANSB_Page, null, $outfile, null, false, true, false, false,
false, false)
$outfiles.push($outfile);
}
catch(theError)
{
$error = theError;
$doc.closeDoc( {bNoSave : true} );
}
}
204
Enfocus Switch 10