---
title: "Custom scripts for document automation"
canonical_url: "https://www.nutrient.io/guides/document-automation-server/content-extraction/custom-scripts/custom-scripts-samples/"
md_url: "https://www.nutrient.io/guides/document-automation-server/content-extraction/custom-scripts/custom-scripts-samples.md"
last_updated: "2026-06-09T10:25:14.360Z"
description: "Discover sample scripts for content extraction and automation processes, including PDF stamping and CSV to XML conversion."
---

# Explore custom scripts for document automation

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](/guides/document-automation-server/content-extraction/custom-scripts.md), the following output is generated:![Output Generated](@/assets/guides/document-automation-server/content-extraction/image117.png)

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 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 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 named `column1`,`column2`, etc.

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

---

## Related pages

- [Efficient content extraction with custom scripts](/guides/document-automation-server/content-extraction/custom-scripts/custom-script-arguments.md)
- [Harnessing custom scripts in document automation](/guides/document-automation-server/content-extraction/custom-scripts.md)
- [Enable custom scripts for automation tasks](/guides/document-automation-server/content-extraction/custom-scripts/enabling-custom-scripts.md)

