> For the complete documentation index, see [llms.txt](https://docs.copia.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.copia.io/docs/devicelink/basic/cognex/cognex-dataman.md).

# Cognex DataMan

## Overview

Cognex DataMan barcode readers can be backed up with Copia DeviceLink using the [Scripting](https://docs.copia.io/docs/devicelink/basic/copia-scripting.md) integration. This is a coordinated backup: a DataMan backup file (`.dmb`) is saved with the DataMan Setup Tool to a folder on the Copia Agent, and a Copia Script project picks it up and commits it to the repository.

## Requirements

Below are the requirements to configure a Copia Agent for the backup of Cognex DataMan:

* The [**DataMan Setup Tool**](https://support.cognex.com/en/products/dataman-setup-tool) installed on the Copia Agent, or on a PC that can save files to a folder the Agent can access.
* Network access from that PC to the DataMan barcode reader.
* The Agent should be tested to confirm that it can backup the desired files utilizing the script on the Agent.
* The script path must be permitted by the Agent's [Script Path Allowlist](https://docs.copia.io/docs/devicelink/basic/copia-scripting#script-path-allowlist).

## Cognex DataMan Configuration

It will be helpful to have a unique name for each reader, `{unique_reader_name}`, which is used in the steps below.

1. Create a folder on the Copia Agent for each reader, for example `c:\temp\dataman\{unique_reader_name}`.
2. Open the DataMan Setup Tool and connect to the reader.
3. Save a backup of the reader configuration (`.dmb`) to the folder created above. Keep the same file name each time; each backup becomes a new commit in the Copia repository.
4. Repeat whenever the reader configuration changes, or on a regular schedule.

{% hint style="info" %}
A `.dmb` backup file is a renamed `.zip` archive that contains the reader configuration files. Copia stores it as a single file.
{% endhint %}

## Scripts

1. Create a new text file on the Copia Agent in `c:\copia\scripts\` and rename it `dataman_backup.bat`.
2. Edit the file, enter the text below, and save it. The script copies the newest `.dmb` file from the reader's folder.

```batch
echo Running DataMan Backup Script...
@echo off
REM -Setup-------------------------------------------------------------
echo %date% %time% Starting DataMan Backup Script >> %temp%\backup_results\CopiaError.log
set SrcDir=c:\temp\dataman\%1
echo %date% %time% Source folder is: %SrcDir% >> %temp%\backup_results\CopiaError.log

REM -Script: copy the newest .dmb file------------------------------------
set Found=
for /f "delims=" %%f in ('dir /b /o-d "%SrcDir%\*.dmb"') do (
  copy "%SrcDir%\%%f" %temp%\backup_results\ >nul
  set Found=1
  goto copied
)
:copied
if not defined Found (
  echo %date% %time% No .dmb file found in %SrcDir% >> %temp%\backup_results\CopiaError.log
  exit /b 1
)
echo %date% %time% Completed Backup Command >> %temp%\backup_results\CopiaError.log

REM -Remove Error Log = It worked!-------------------------------------
del %temp%\backup_results\CopiaError.log
exit
```

Create the script on the Copia Agent and add its path to the Agent's [Script Path Allowlist](https://docs.copia.io/docs/devicelink/basic/copia-scripting#script-path-allowlist). This only needs to be done once per Copia Agent.

The script follows the [Copia Scripting](https://docs.copia.io/docs/devicelink/basic/copia-scripting.md) requirements: results are placed in `%temp%\backup_results\`, and `CopiaError.log` is deleted only when the backup succeeds. Test the script from the command line on the Agent before configuring the project.

## Project Configuration

Script projects require a File List to determine what files in the %temp%\backup\_results folder to include and exclude, as well as the contents to exclude from the compare. More information can be found in [File List](https://docs.copia.io/docs/devicelink/sitesandagents/sites/file-lists.md) section.

To configure a Cognex DataMan project, you need a repository with a Project folder to store the data. The name of the folder is usually similar to that of the device.

Click either of the *Add a Project* buttons in the Projects tab.

<figure><img src="https://3704730939-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4lSQNVI3DZ15V7kjkMCA%2Fuploads%2FbYUhCGn4igZ2xKfqBQot%2Fimage.png?alt=media&amp;token=4b93d171-1e9f-499b-ae23-2ef5c3f8065d" alt=""><figcaption></figcaption></figure>

The *Add a new project* configuration dialog will appear which allows you to fully configure the project, devices and job for the project.

<figure><img src="https://3704730939-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4lSQNVI3DZ15V7kjkMCA%2Fuploads%2FHHrIUe1bbZ88OZXaHYsy%2Fimage.png?alt=media&amp;token=e8212ee1-495f-40c8-9fd9-90cf8a95c60f" alt=""><figcaption></figcaption></figure>

#### Define the Project

To get started, select **Script** as the *Project Type*, and then select an *Agent*. See more about this in the [Agents](https://docs.copia.io/docs/devicelink/sitesandagents/agents.md) section of the documentation.

When complete, press *Save and Continue*.

<figure><img src="https://3704730939-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4lSQNVI3DZ15V7kjkMCA%2Fuploads%2FvPoXWTVxZv5vuN2N3Erq%2Fimage.png?alt=media&amp;token=9df30908-8804-455e-814c-68d6cf574f96" alt=""><figcaption></figcaption></figure>

You will now select the Project Path, which is the location (Repo/Branch) that the project is, or will be stored.&#x20;

<figure><img src="https://3704730939-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4lSQNVI3DZ15V7kjkMCA%2Fuploads%2FuU6v7wPPJr9NsGtuMDGW%2Fimage.png?alt=media&amp;token=f436aa27-abd4-435b-9e05-5929a83611f1" alt=""><figcaption></figcaption></figure>

You can either select an existing folder, or create a new empty folder. Once complete, press *Save and Continue* to proceed.

<figure><img src="https://3704730939-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4lSQNVI3DZ15V7kjkMCA%2Fuploads%2Ft10DfGqX8pasHp3M1vgW%2Fimage.png?alt=media&amp;token=54f56118-ca12-4153-8a42-b15c3e641ecc" alt=""><figcaption></figcaption></figure>

The project details allows you to update the Project name, and description if desired. You will need to provide:

* **Script Path:** `c:\copia\scripts\dataman_backup.bat`
* **Script Arguments:** `{unique_reader_name}`
* **File List:** select an existing file list, or create one with **Name** `Cognex_DataMan`, **Include in Backup** `*.dmb`

<figure><img src="https://3704730939-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4lSQNVI3DZ15V7kjkMCA%2Fuploads%2FL6cbglM4GnMDKxSkbnFW%2Fimage.png?alt=media&amp;token=d4f5ddb8-6e17-4d88-9116-960be2ba47ea" alt=""><figcaption></figcaption></figure>

#### Define the Device

Since the Script exists on the Agent, there is no need to define a Device for Projects that use a Script during setup. You can skip to the Job section.

#### Define the Job

Creating Jobs is similar for all vendor types, and is described in the [Creating Jobs](https://docs.copia.io/docs/devicelink/jobs/creating-jobs.md) section. It is recommended to review that section while completing a job configuration, and press Save to save the job. You can create more than one job for a device if desired.

#### Submit the Configuration

Once complete, press *Submit Project Setup* to create the Project, Device and Job.

<figure><img src="https://3704730939-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4lSQNVI3DZ15V7kjkMCA%2Fuploads%2FytgnmVlKRsiPdIwcX2J8%2Fimage.png?alt=media&amp;token=f1a5b8fe-2063-49bd-948f-61a0439deaf4" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.copia.io/docs/devicelink/basic/cognex/cognex-dataman.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
