FAQ: Using custom navigation software for documents published to USB

The normal way users open documents published to USB by Safeguard Portable, is by launching autorun.exe and then selecting which document to open.  This launches the Viewer from the USB drive.

If you want to use custom navigation software (so that you can customize the interface, use different folder structures, etc.), then it must call the Viewer on the USB device – opening the document via your navigation software will attempt to launch the Windows Viewer, and not the one on the USB drive (this is just how Windows handles it).  This is the same as trying to open the document via right-click + Open or double-clicking on it.  Choosing the Viewer on the USB drive as the default application with which to open .pdc files won’t work either as the user would have to manually select this each time (since the Viewer isn’t installed under Windows).

To work around this, you can either get your navigation software to launch an exe (the Viewer) with a parameter (the document) or create a batch (.bat) file for each document that calls the USB Viewer to open the document.  When a user browses via your navigation software to a document and clicks on it, the .bat file is run instead of the document.  In the .bat file, you need to open the Viewer on the USB drive and pass the PDC document to it (relative path to it).  This way, the Viewer on the USB will launch to open the document.  This has to be done for each document (a .bat file for each .pdc).

Below is an example for the .bat file:

  1. Create your USB with the Viewer included and one PDC called document.pdc.
  2. Create a .bat file in the root of the USB with the following contents (quotes included):
    “%~dp0\Viewer\PDCViewer.exe” “%~dp0\document.pdc”
  3. Save the batch file and launch it. It should open the Viewer from the USB device with the document.pdc file loading from the root folder.

Some other examples:

  1. If you want to add the pdc document to a folder and launch the document from that folder (with the .bat located in the root of USB device), do this:
    “%~dp0\Viewer\PDCViewer.exe” “%~dp0\folder\document.pdc”
  2. If you want to add the .bat file in the same folder as the pdc document, you need to launch it like this (one folder):
    “%~dp0\..\Viewer\PDCViewer.exe” “%~dp0\document.pdc”
  3. For a document located in a subfolder (e.g. [DRIVE]:\\folder\subfolder\document.pdc) do this:
    “%~dp0\..\..\Viewer\PDCViewer.exe” “%~dp0\document.pdc”