Hi
I am testing some batch PDF creation with Bullzip using Microsoft Access 2003 on Vista. Here is the main bit of code I am using:
iCounter = 20000
Do Until icounter = 20040
sSleep 2000 'milliseconds
myobject.SetValue "output", sDir & "\" & iCounter & ".pdf"
myobject.SetValue "showsettings", "never"
myobject.SetValue "showpdf", "no"
myobject.WriteSettings (True) 'writes the settings in a runonce.ini that it immediately deleted after being used.
DoCmd.OpenReport "CCSSitesByRegionAndCity", , , "ID = " & iCounter
iCounter = iCounter + 1
Loop
As you can see I have had to put a 2 second sleep in before writing the runonce.ini. Without the sleep I would get the bullzip save file dialog pop up for various iterations of the loop, and often an error message saying that it could not write to runonce.ini because it was locked.
I assume that this is because of a timing issue between runonce.ini getting written, Bullzip printing the document using the file and the file getting deleted after printing is completed ie. while the printer is still printing the last iteration, the code writes the runonce for the new iteration, but as the printing of the previous iteration finishes it deletes the new file.
Is there a way of using the API so that it waits to write the Runonce.ini until the current print action has completed?
Thanks
Matthew
VBA and Timing
Moderator: jr
Hi -
As I mentioned in my posting under "COM Interface for Print Job Status", use FileSystemObjects FileExists, but this time on the runonce.ini file. Instead of a counter, just loop while runonce.ini exists....
Dim fso as new FileSystemObject
while fso.FileExists(<Path>"\runonce.ini")
wend
myobject.SetValue "output", sDir & "\" & iCounter & ".pdf"
myobject.SetValue "showsettings", "never"
myobject.SetValue "showpdf", "no"
myobject.WriteSettings (True) 'writes the settings in a runonce.ini that it immediately deleted after being used.
etc,etc....
This will positively hold up processing until runonce.ini is deleted from the last run.
Pliny
As I mentioned in my posting under "COM Interface for Print Job Status", use FileSystemObjects FileExists, but this time on the runonce.ini file. Instead of a counter, just loop while runonce.ini exists....
Dim fso as new FileSystemObject
while fso.FileExists(<Path>"\runonce.ini")
wend
myobject.SetValue "output", sDir & "\" & iCounter & ".pdf"
myobject.SetValue "showsettings", "never"
myobject.SetValue "showpdf", "no"
myobject.WriteSettings (True) 'writes the settings in a runonce.ini that it immediately deleted after being used.
etc,etc....
This will positively hold up processing until runonce.ini is deleted from the last run.
Pliny
I found out that none of this solutions are 100%. Try and run some test scenarios - generate some various numbers of pdf documents. I can guarantee that there will be synhronization issues and some dialogs will popup.
The resolution is very simple - use the callback functionality that BullZip PDF printer supports, when the printer finishes a job you get a callback (eihter success or error or both) and after that you progress to anonther print job.
The resolution is very simple - use the callback functionality that BullZip PDF printer supports, when the printer finishes a job you get a callback (eihter success or error or both) and after that you progress to anonther print job.