Bullzip command line quotation marks
Posted: Sat Feb 11, 2012 11:46 pm
Dear bullzip team,
below http://www.biopdf.com/guide/examples/batch_printing/ I found vbs code for batch creation of .pdfs with bullzip. Based on my limited programing knowledge and some examples on the internet I tried to convert the code to vba to use it within an excel makro which I had programmed earlier. This is the result:
--------------------------
Sub PrintSheetAsPDFwithBullZip()
Dim fso As New FileSystemObject
Dim cff As New Bullzip.PDFPrinterSettings
Dim currentdir As String
currentdir = "C:\Bullzip\batch"
cff.SetPrinterName ("Bullzip PDF Printer")
Set fldr = fso.GetFolder(currentdir & "\in")
cnt = 0
For Each f In fldr.Files
With cff
cnt = cnt + 1
output = currentdir & "\out\" & Replace(f.Name, ".txt", "") & ".pdf"
Rem -- Set the values
.Init
.SetValue "Output", output
.SetValue "ShowSettings", "never"
.SetValue "ShowPDF", "no"
.SetValue "WatermarkText", Now
.SetValue "ShowProgress", "yes"
.SetValue "ShowProgressFinished", "no"
.SetValue "SuppressErrors", "no"
.SetValue "ConfirmOverwrite", "no"
Rem -- Write settings to the runonce-Invoice.ini
.WriteSettings True
End With
Rem -- Print the document
PrintFile = currentdir & "\in\" & f.Name
cmd = currentdir & "\printto.exe " & PrintFile & " " & Chr(34) & "Bullzip PDF Printer" & Chr(34)
Call VBA.Shell("C:\Windows\system32\cmd.exe /c " & cmd, 0)
Application.Wait (Now + TimeValue("0:00:01"))
Next
End Sub
--------------------------
As you can see I wasnt very successfull. It doesnt work either; Although it runs without crashing, nothing is beeing created within the "out" folder. It appears to me that the reasons for the problem are the quotation marks that are automatically beeing put in front and at the end of the "cmd" string: "C:\Bullzip\batch\printto.exe C:\Bullzip\batch\in\1.txt "Bullzip PDF Printer""
If I copy the code manualy in the command line without the quotation marks it seems to work: C:\Bullzip\batch\printto.exe C:\Bullzip\batch\in\1.txt "Bullzip PDF Printer".
Does someone have a solution to this?
Thanks in advance,
Andreas
below http://www.biopdf.com/guide/examples/batch_printing/ I found vbs code for batch creation of .pdfs with bullzip. Based on my limited programing knowledge and some examples on the internet I tried to convert the code to vba to use it within an excel makro which I had programmed earlier. This is the result:
--------------------------
Sub PrintSheetAsPDFwithBullZip()
Dim fso As New FileSystemObject
Dim cff As New Bullzip.PDFPrinterSettings
Dim currentdir As String
currentdir = "C:\Bullzip\batch"
cff.SetPrinterName ("Bullzip PDF Printer")
Set fldr = fso.GetFolder(currentdir & "\in")
cnt = 0
For Each f In fldr.Files
With cff
cnt = cnt + 1
output = currentdir & "\out\" & Replace(f.Name, ".txt", "") & ".pdf"
Rem -- Set the values
.Init
.SetValue "Output", output
.SetValue "ShowSettings", "never"
.SetValue "ShowPDF", "no"
.SetValue "WatermarkText", Now
.SetValue "ShowProgress", "yes"
.SetValue "ShowProgressFinished", "no"
.SetValue "SuppressErrors", "no"
.SetValue "ConfirmOverwrite", "no"
Rem -- Write settings to the runonce-Invoice.ini
.WriteSettings True
End With
Rem -- Print the document
PrintFile = currentdir & "\in\" & f.Name
cmd = currentdir & "\printto.exe " & PrintFile & " " & Chr(34) & "Bullzip PDF Printer" & Chr(34)
Call VBA.Shell("C:\Windows\system32\cmd.exe /c " & cmd, 0)
Application.Wait (Now + TimeValue("0:00:01"))
Next
End Sub
--------------------------
As you can see I wasnt very successfull. It doesnt work either; Although it runs without crashing, nothing is beeing created within the "out" folder. It appears to me that the reasons for the problem are the quotation marks that are automatically beeing put in front and at the end of the "cmd" string: "C:\Bullzip\batch\printto.exe C:\Bullzip\batch\in\1.txt "Bullzip PDF Printer""
If I copy the code manualy in the command line without the quotation marks it seems to work: C:\Bullzip\batch\printto.exe C:\Bullzip\batch\in\1.txt "Bullzip PDF Printer".
Does someone have a solution to this?
Thanks in advance,
Andreas