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 just lists the named arguments supplied by Kingfisher.

Using the example call above results in the following output:

Included (but commented out) is code to list all arguments supplied.

This sample is useful to check the call to the script from Kingfisher and assist in the development of additional custom scripts.

archiveinputs.wsf

This script copies (or moves) the input file to an archive location.

Please ensure you fully understand and have tested 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 this to your archive location.

  • Line 15: var move = "false";

Set to true to move the file instead of copying it.

This script returns certain 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, this 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, this can be found in the “stamp” subfolder of the custom.zip file.

Line 19: var stampText = "Processed by %value1%". This is the text that will be stamped on the PDF file, the script will replace the %valuex%”` in the string with the values extracted from the document by Kingfisher. E.g. if the text extract from the file is “Admin Department”, the stamp will be “Processed by Admin Department”

converttoxml.wsf

This script converts a CSV output file from Kingfisher 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 false, the xml nodes will be named column1,column2 etc.

  • Line 17 var csv2XmlExe = "C:\\Aquaforest\\Kingfisher\\custom\\csvtoxml\\CSV2XML.exe". Provide the path to the CSV2XML.exe file, this can be found in the csvtoxml subfolder of the custom.zip file.