LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

System Exec.VI: merging pdf files using PDFCreator

Hi all.

I'm using LabVIEW 2017 (32bit) on a PC running OS Windows 10 Pro (64bit).

I have installed PDFCreator free v4.4.0.10

 

The target is to automatically merge some .pdf files (most are generated from VI FP printed on exit) to get 1 report file only

 

The SW loads, from a .ini file, some path, the printer name, and the command string that merge the files.

 

As first step, a complete list of files to merge is returned, then strings are composed, and finally the command is executed.

 

There is no error, but the merge is not performed.

Sending the exact same string froma terminal, the merge is carried out.


in the attached example, the content of batch file is:

 

REM "c:\Users\user\Desktop\test\mymerge.bat">"%USERPROFILE%\Desktop\test\result.txt"
echo %ProgramFiles%
cd "%USERPROFILE%\Desktop\test"
"C:\Program Files\PDFCreator\PdfCreator-cli.exe" mergefiles /OutputFile="%USERPROFILE%\Desktop\test\totale.pdf" "printed.pdf" "printed_2.pdf"
cd..
cd.

 

the command to be executed is the string that follows the REM command

 

"c:\Users\user\Desktop\test\mymerge.bat">"%USERPROFILE%\Desktop\test\result.txt"

 

Running manually the command from a command window, the result is


C:\Users\user>REM "c:\Users\user\Desktop\test\mymerge.bat">"C:\Users\user\Desktop\test\result.txt"

C:\Users\user>echo C:\Program Files
C:\Program Files

C:\Users\user>cd "C:\Users\user\Desktop\test"

C:\Users\user\Desktop\test>"C:\Program Files\PDFCreator\PdfCreator-cli.exe" mergefiles /OutputFile="C:\Users\user\Desktop\test\totale.pdf" "printed.pdf" "printed_2.pdf"
Created job file C:\Users\user\AppData\Local\Temp\PDFCreator\Spool\printed.pdf\printed.pdf.inf
Pipe server is running
Pipe message has been sent

C:\Users\user\Desktop\test>cd..

C:\Users\user\Desktop>cd.

 

while, using LabVIEW, the system exec.vi returns:


C:\WINDOWS\system32>REM "c:\Users\user\Desktop\test\mymerge.bat">"C:\Users\user\Desktop\test\result.txt"

C:\WINDOWS\system32>echo C:\Program Files (x86)
C:\Program Files (x86)

C:\WINDOWS\system32>cd "C:\Users\user\Desktop\test"

C:\Users\user\Desktop\test>"C:\Program Files\PDFCreator\PdfCreator-cli.exe" mergefiles /OutputFile="C:\Users\user\Desktop\test\totale.pdf" "printed.pdf" "printed_2.pdf"

C:\Users\user\Desktop\test>cd..

C:\Users\user\Desktop>cd.

 

 

Two more minor issues I have noticed:

 

Running the batch file from terminal, system variable %ProgramFiles% is set to  C:\Program Files, while, using LabVIEW, is set to C:\Program Files (x86), so, the original command "%ProgramFiles%\PDFCreator\PdfCreator-cli.exe" mergefiles /OutputFile="%USERPROFILE%\Desktop\test\totale.pdf"

has been changed into  "c:\Program Files\PDFCreator\PdfCreator-cli.exe" mergefiles /OutputFile="%USERPROFILE%\Desktop\test\totale.pdf"

 

The original command "%USERPROFILE%\Desktop\test\mymerge.bat">"%USERPROFILE%\Desktop\test\result.txt"

has been changed into  "c:\Users\user\Desktop\test\mymerge.bat">"%USERPROFILE%\Desktop\test\result.txt"

terminal, otherwise LabVIEW return an error (value 2) after calling System Exec.vi

 

0 Kudos
Message 1 of 1
(1,027 Views)