Opening PDF Files on the Computer by Scanning Barcodes
Open PDF Files using a Barcode Scanner?
We made a dedicated app just for that, download it for free!
Want to use a smartphone?
In this case use Barcode to PC. Continue reading the instructions below.
If instead, you want to open the urls on the smartphone import this template: open_urls.btpt, just double-click on it after you install Barcode to PC.
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
- Open the server settings by clicking the gear-shaped icon
- Drag & drop the RUN component to the Output template
- Click the RUN component and edit the command field as explained below
- 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"
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?
To execute other programs you should use the RUN component, which is equivalent to executing a command from the Windows command prompt.
In your case, to execute VBA scripts, take a look here: https://stackoverflow.com/questions/2050505/way-to-run-excel-macros-from-command-line-or-batch-file