Custom Scripts Samples
There are four sample scripts in a zip file in the <installation folder>\docs
folder called custom.zip
.
Extract these to a suitable location (such as <installation folder>\Custom
).
testarguments.wsf
This lists the named arguments supplied by Document Automation Server (DAS) Content Extraction.
Using the example call mentioned here, the following output is generated:
Included (but commented out) is code to list all arguments supplied.
This sample is useful to check the call to the script from DAS Content Extraction and assist in the development of additional custom scripts.
archiveinputs.wsf
This script copies (or moves) the input file to an archive location.
Ensure you fully understand and test this process if you choose to use the move option.
This has been tested with the file system job only.
Open the file with a text editor of your choice and apply the following changes to use the script:
-
Line 14:
var ArchiveTarget = "%ARCHIVELOACTION%";
. Change%ARCHIVELOACTION%
to your archive location. -
Line 15:
var move = "false";
. Set move = true to move the file instead of copying it.
The script returns one of the following exit codes when executed:
Exit Code | Description |
---|---|
0 | Success |
1 | Destination folder not found |
2 | Error in process |
3 | Source file not found |
This is a revised script. The previous script is also supplied.
stamp.wsf
This script applies a stamp to the first page of the output PDF file. The stamp can contain the values extracted from the file. Open the file with a text editor of your choice and apply the following changes to use the script:
-
Line 18:
var stampExe = "C:\\Aquaforest\\Kingfisher\\custom\\stamp\\stamp.exe"
. Provide the path to the stamp.exe file. It can be found in the stamp subfolder of thecustom.zip
file. -
Line 19:
var stampText = "Processed by %value1%"
. This is the text that will be stamped on the PDF file. The script replaces the%valuex%
”` in the string with the values extracted from the document by DAS Content Extraction. For example, if the text extracted from the file is “Admin Department”, the stamp will be “Processed by Admin Department”.
converttoxml.wsf
This script converts a CSV output file from DAS Content Extraction to an XML and copies the file to the target directory. This has been tested with the file system job only. Open the file with a text editor of your choice and apply the following changes to use the script:
-
Line 14:
var XmlRoot = "books"
. This represents the root xml node. -
Line 15:
var XmlElement = "book"
. This is the name of the node that represents each record in the CSV. -
Line 16:
var HasColumnNames="true"
. This will use the first row of the CSV file as the names of the xml nodes that represent the CSV Records. If you use HasColumnNames = false, the xml nodes will be namedcolumn1
,column2
, etc. -
Line 17
var csv2XmlExe = "C:\\Aquaforest\\Kingfisher\\custom\\csvtoxml\\CSV2XML.exe"
. Provide the path to theCSV2XML.exe
file. It can be found in the csvtoxml subfolder of thecustom.zip
file.