How to use the RUN Output component

Posted on

The RUN Output Component allows you to execute commands and programs when a barcode is scanned from your smartphone.

Executing commands

Follow this procedure:

  1. Drag & drop the RUN Component from the Available components field to the Output template field
  2. Put the command you want to execute in the Command field
  3. Save & Apply the server settings

 
Like this:

The output produced by the command can be used for the Keyboard Emulation feature, and for the Append to CSV file option.

Pass parameters

The RUN component allows you to pass the value of other components to your programs (or scripts) by using the double-curly braces syntax.

Command example: program.exe {{ barcode }}

Available variables list:

  • barcode
  • number
  • text
  • timestamp
  • date
  • time
  • scan_session_name
  • device_name
  • select_option

 

☝️ Note: to use the variables listed above you must add the corresponding Output component before the RUN component in your Output Template.

 

For example if you want to use the number variable, your Output template should look like this:

output template

To prevent the NUMBER component affecting the Keyboard Emulation output you can click on it and enable the Skip output option.

 

Retrieving parameters in Python

You can use the following commands to trigger a Python script:
 
Windows: C:\Python37\python.exe C:\python.py {{ barcode }} {{ number }}
macOS or Linux: /usr/bin/python /python.py {{ barcode }} {{ number }}
 
Like this:

run_example
 

☝️ Note: the Python executable path may vary depending on your Python version and your OS.

To access the barcode and number variables you can use the following code:

Retrieving parameters in Node

You can use the following commands to trigger a Node script:
 
Windows: C:\Program Files\nodejs\node.exe C:\script.js {{ barcode }} {{ number }}
macOS or Linux: /usr/local/bin/node /script.js {{ barcode }} {{ number }}
 

To access the barcode and number variables you can use the following code:

Retrieving parameters in Shell Scripts

You can use the following command to run Shell script:
 
/bin/zsh /Users/YOUR_USERNAME/Desktop/my_script.sh {{ barcode }} {{ number }}
 
And read the parameters like this:

Retrieving parameters in Batch Files

You can use the following command to run Shell script:
 
cmd.exe /c C:\Users\YOUR_USERNAME\Desktop\my_script.bat {{ barcode }} {{ number }}
 
And read the parameters like this:

☝️ Final Note

Inside the command field you can put any command you want, but keep in mind that the working directory is set accordingly to your OS home directory.

To avoid issues it’s suggested to always use absolute paths, for example:

Windows: C:\myprogram.exe
macOS or Linux: /my_executable

Comments

No comments found. Be the first to leave a comment.

Your email address will not be published. Required fields are marked *

Related posts