Opening PDF Files on the Computer by Scanning Barcodes

Last updated: Jun 11th 2021

Every time a barcode is acquired from the app, it is immediately sent to the server. If you want to execute a custom action such as opening a file, you have to edit the Output template by adding a RUN component to it.

This way the final behavior will be to acquire a barcode and execute the command specified inside such RUN component.

In this case, we’ll put a command to open files.

Instructions

  1. Open the server settings by clicking the gear-shaped icon
  2. Drag & drop the RUN component to the Output template
  3. Click the RUN component and edit the command field as explained below
  4. Save & apply the settings

Like this:

Command

To open files when a barcode is scanned, you have to use the start command for Windows and the open command for macOS, followed by the file path. This way the files will be opened using the default program associated with the corresponding file extension.

 

You can either use a static file path to always open the same file when a barcode is scanned, and thus use a command that looks like this:

Windows: start "C:\Users\filippo\Desktop\file.pdf"
macOS: open "/User/filippo/Desktop/file.csv"

Or, instead, you can use a dynamic file path that, for example, uses the barcode value as file name, like this:

Windows: start "C:\Users\filippo\Desktop\{{ barcode }}.pdf"
macOS: open "/User/filippo/Desktop/{{ barcode }}.pdf"

 

Note: Since the RUN component depends on the BARCODE component, it’s crucial that you drag & drop it after the BARCODE component, in step 2.

Opening files with non-default programs (optional)

If you want to open the file with another program, you have to change the command so that the file path is preceded by the program executable path, like this:

Windows: "C:\Program Files\PDFReader\pdfreader.exe" "D:\{{ barcode }}.pdf"
macOS: /Applications/PDFReader "/tmp/{{ barcode }}.pdf"

Comments

  1. Is there a way to execute a VBA Excel UserForm with RUN or JAVA? I can open the file but im not sure how to execute a CommandButton… is it posible?

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

Related posts