DataMan Scripting

DataMan Scripting Large

The Cognex DataMan series of barcode readers uses JavaScript to customize several important functions, such as data formatting and transferring images to an FTP site. This video provides an overview of scripting operations using the DataMan Setup Tool, a software application that configures DataMan barcode readers.


Topics covered in the video:

Why DataManReaders Use Javascript

Scripting helps to simplify the integration of programmable logic controllers (PLCs) and DataMan barcode readers into a factory network. Scripts also manage the inputs and outputs of digital data and enable:

  • Data formatting for:

  • Output strings and string comparison

  • Statistics and metrics 

  • Input and output states

  • Set or Get parameters  

  • FTP storage (image renaming and transfer of images and data)

  • Communications with external devices, setting a timer and managing encoder input 


How to Enable DataMan Scripting


The Setup Tool is used to initiate scripting. There are several steps in this process:


  • Connecting to the DataMan barcode reader

  • Clicking on the Format Data square at the bottom left of the screen

  • Selecting “script-based formatting” and clicking a link to execute the command 


Scripting Samples for Data Formatting, FTP Storage and Communications 


Three primary DataMan scripts perform basic functions like data formatting, FTP storage and communication:


  1. Data formatting.Examples include comment text, the “onResult” function, “if” conditions, “output.content” and output strings.

  2. FTP storage. Examples include generating image names before FTP transfer, process control metrics (PCM) reports and verification reports.  

  3. Communications. Examples include “onConnect” and “onDisconnect,” “onExpectedData,” (called after receiving a data string from an external device) and “onTimer,” (called after the timer counts to zero).



The DataMan image processing sequence involves five steps:


  1. Image acquisition
  2. Processing
  3. Validation
  4. Scripting
  5. Output


Each step is reviewed in detail in the video.

DataMan Control Commands (DMCC)

DMCC is a Cognex protocol for communicating with DataMan barcode readers. Sample commands include:

  • ||> GET TRIGGER.TYPE — returns the value of a parameter setting

  • ||> GET RESULT — returns the last result of a decoded string 

  • ||> SET SYMBOL.DATAMATRIX ON — Sets the value of a parameter 

  • ||> Reboot — Makes the barcode reader perform an action

All DMCCs are available in the DataMan Setup Tool and accessible by clicking on “Help” in the top right corner of the screen.


More Posts on


Join MyCognex


Cognex representatives are available worldwide to support your vision and industrial barcode reading needs.

Contact Us