Link to home
Start Free TrialLog in
Avatar of digdug89
digdug89

asked on

Print routine to open AcroRd32.exe , print file on network, CLOSE AP(this is problem)

I have asked this question before, but I am still stuck.  I am using a dos batchfile to print a .pdf drawing from our server.  I can get the file to print, however Adobe seems to "hang" after the file is printed.  I have used the /p /t commands to no avail. I have even found a process terminator that will end the process, but I don't think this is a viable solution. It needs to print with no user intervention.  So, what I am asking for is : Simple code either in a batchfile or Vbapp that will accept in 3 parms (printer-name, Directory,filename) and print the correct file.  Such as.....
@echo off
c:
net use lpt1: /delete /y
net use lpt1: \\vactor_wts_nt1\mislaser

cd c:\progra~1\adobe\acroba~1.0\reader
acrord32.exe /p /h c:\shop\shop\PD-58491A-A.Pdf
pv -k -f acrord32.exe

Exit

This code will print the document ok, but will not CLOSE Adobe.  It will not execute pass the print pdf line.  PLEASE HELP!
Avatar of Karl Heinz Kremer
Karl Heinz Kremer
Flag of United States of America image

Use this command:
AcroRd32.exe /t path printername drivername portname

The /t flag prints and terminates Acrobat Reader
BTW: The /h flag that you are using opens Acrobat or Reader in "hidden" mode, but it stays open.
Avatar of digdug89
digdug89

ASKER

Thank you for your post. However, I have used the acrord32.exe /p /t c:\shop\shop\PD-58491A-A.Pdf, but the app still remains open.  After researching this, It seems that Adobe changed this command in 6.0 which we are currently using.  I have used multiple combinations, but have not yet found one that will close Adobe Reader.
Don't use /p /t, just /t.
The parameter is still documented in the Acrobat 6 SDK. BTW: You don't have to provide all four parameters. It does work if you just specify the file name and the printer name.
I think you are right: It looks like Acrobat Reader does not get terminated after the file prints. And it also looks like you need all four parameters. I'll keep looking.
yes, I think Adobe reader 6 doesnot suppport /t ...Download Adobe reader 5 - available in
cgim.adobe.com/acrobat/reader18/download.cgi?JustSendFile=Y

Try this out....

The syntax for printing a .PDF document from the command-line is:

PathToAcrobat.exe /t Filename Printer PrintDriver PrinterPort

where:

PathToAcrobat.exe       is the path to Acrobat.exe or Acrord32.exe.
/t                                prints the document and is supposed to terminate.
Filename                     is the path to the .PDF document you wish to print.
Printer                         is the name of the printer you want the document to print on.
PrinterDriver                from the printer's Properties page.
PrinterPort                  The printer's port, which cannot contain any / characters.


Example:
"C:\Program Files\Adobe\Acrobat 5.0\Reader\AcroRd32.exe" /t "C:\Saved\Protect_Your_PC.pdf" \\JSI001\HP2250 "HP Business Inkjet 2250 (PCL5C)" LPT1:

check this also:

https://www.experts-exchange.com/questions/20706656/Print-a-PDF.html
Using Reader 5 does however mean that you cannot print any files that use PDF1.5 features.
I have tried the command  :\progra~1\adobe\acroba~5.0\reader\acrord32.exe /t c:\filename \\networkprinter , and it seems to have the same result.  The file prints fine, but adobe remains open. Termination of adobe is key for me since I am running this batchfile from our as/400. It needs to close to allow the 400 to finish its processing. Thank you all for your responses! Could it be that I need all 4 parameters? I have use both 5.0 and 6.0 reader.


Download Adobe Reader 4 from...
http://cgim.adobe.com/acrobat/reader14/download.cgi?JustSendFile=Y
ftp://ftp.adobe.com/pub/adobe/acrobatreader/win/4.x/ar405eng.exe

what version of pdf  - You use.. 1.3 or 1.4 or 1.5.

Whether u have tested printing via Adobe reader 4 in AS/400 before...
I did a few more experiments, and it really looks like this feature (even though still mentioned in the latest SDK documentation) is gone. The problem is that these parameters were never documented. The Developer FAQ just listed them as undocumented and said that some developers were sucessful in using them...

If your objective is to print a PDF file automatically, there are other solutions. Free ones and commercial ones. What type of printer are you using? If it's a Postscript printer, then the solution is pretty straight forward: Just install Ghostscript and use it's pdf2ps filter. Then spool the PS file to your printer. If it's not a PS printer, you can still use Ghostscript with the correct output module for your printer.

I don't have any links to commercial software right now, but I'll be back with more.
ASKER CERTIFIED SOLUTION
Avatar of Karl Heinz Kremer
Karl Heinz Kremer
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
khkremer i was type the text & i have not seen you text ...before...submitting..

check this out

http://www.planetpdf.com/asp/default.asp?action=9&read=36960&fid=52#97819

Commandline Acrobat 6.0 details found -- with kill application for close Adobe reader
Thank you for your suggestions.  One problem I have is, I need to call this app from our as400 and pass 3 parms(printername,directory,filename).  The close app program is similiar to what I currently have.  However, after excuting adobe to print the file, it seems to "hang" until the application is closed through the end task option.  The next line in the batch file will NOT execute until this has happened.  Once closed the rest of the batch file seems to execute normally.  I am checking into ghost script now, but I believe the problem will arise that I need to send the parms. It might be that there is no viable solution for this.  I am coming to that conclusion. User interaction seems to be a must with all these programs.
I would not call this "commandline Acrobat 6.0 details found", it's still the same (undocumented) parameter :-)
Killing the application may cause problems depending on the type of printer you are using (at least I think this is what causes the different behavior): On two different machines I have seen two different behaviors: One one machine the AcrRd32.exe command does not return, on my second machine it returned right away and created the print job in the background. In both cases you would have a hard time to find the right moment to kill the process.
Also, starting the reader with the print flag will fail (at least on my system) if onother instance of Acrobat or Reader is already running. You may be able to get around this by specifying the /n parameter (which creates a new instance of Acrobat or Reader).
With Ghostscrpt (or Batch&Print Pro) you can write a batch file that takes your three parameters and combines them to a command line for gs or any other program that you need to spool the job, then call the program and just wait until it's done. The program will end automatically (different from Acrobat or Reader).

In the case of gs, you first convert the file to a PS file, which you have to spool to your printer (or to a printable file for your specific printer). You might be able to use the command line lpr command to spool the file to the printer.
I am looking at the documentation for GS, but there isn't much there on command line printing.  Can you maybe show me an example of how to create a command from the example below.  I know I can read in the 3 parms into the batchfile. How to convert them for GS to use would be the tricky part for me.  

Current batch file example

c:
cd c:\progra~1\adobe\acroba~1.0\reader acrord32.exe /t c:\shop\%1\%3 \\vactor_wts_nt1\%2

The %variables are the ones I currently use.
GS is _NOT_ a tool to do command line printing: It is one part of a tool that will allow you to do command line printing. What printer are you using? If it's a Postscript printer, you would use something like this:

pdf2ps -dLanguageLevel=2 c:\shop\%1\%3 c:\temp\%3.pdf

This will create a temporary file c:\temp\%3.pdf
After you create this temp file, you need to spool it. If you can spool print jobs to your printer with the lpr protocol it becomes very simple:
lpr -P %2 c:\temp\%3.pdf

This is not as simple as just providing a few command line parameters to AcroRd32.exe. If you don't think that you have the experience to get this working, you may want to look at the Traction Software package. As I said, they have a free evaluation version, so you can just download the package and give it a try. This will definitely be easier to implement than the Ghostscript solution.
Can you give us a status update?
I am looking into ghostscript now.  However, I am still unable to get adobe to close.  My original intention was to use either a batchfile or a VB program.  I will be glad to award the points if I can get gs to print the pdf.  However, it seems the documentation is limited.  
What printer are you using?

Hi digdug89

Whether Close App /kill app  work for You ?
Option Explicit

Private Declare Function WaitForSingleObject Lib "kernel32" _
(ByVal hHandle As Long, _
ByVal dwMilliseconds As Long) As Long

Private Declare Function FindWindow Lib "user32" _
Alias "FindWindowA" _
(ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long

Private Declare Function PostMessage Lib "user32" _
Alias "PostMessageA" _
(ByVal hwnd As Long, _
ByVal wMsg As Long, _
ByVal wParam As Long, _
ByVal lParam As Long) As Long

Private Declare Function IsWindow Lib "user32" _
(ByVal hwnd As Long) As Long

'Constants used by the API functions
Const WM_CLOSE = &H10
Const INFINITE = &HFFFFFFFF

Private Sub Form_Load()
Command1.Caption = "Print Files"
Command2.Caption = "Close Adobe Reader"
End Sub

Private Sub Command1_Click()
Dim strCommandLine As String
Dim strPrinterName As String
Dim strDriverName As String
Dim strPortName As String
Dim strFileNameToPrint As String

strFileNameToPrint = "c:\test\one.pdf"

strPrinterName = Printer.DeviceName
strDriverName = Printer.DriverName
strPortName = Printer.Port

' Perform some error checking here
      strCommandLine = "C:\Program Files\Adobe\Acrobat 5.0\Reader\AcroRd32.exe /t """ + _
strFileNameToPrint + """ """ + _
strPrinterName + """ """ + _
strDriverName + """ """ + _
strPortName + """" 

If (Shell(strCommandLine, vbHide) <> 0)Then
MsgBox "Job has been sent to the printer using the command " + strCommandLine
End If
End Sub


Private Sub Command2_Click()
'Closes the Windows Adobe reader
Dim hWindow As Long
Dim lngResult As Long
Dim lngReturnValue As Long

hWindow = FindWindow(vbNullString, "Adobe Reader")
lngReturnValue = PostMessage(hWindow, WM_CLOSE, vbNull, vbNull)
lngResult = WaitForSingleObject(hWindow, INFINITE)

'Does the handle still exist?
DoEvents
hWindow = FindWindow(vbNullString, "Adobe Reader")
If IsWindow(hWindow) = 1 Then
'The handle still exists. Use the TerminateProcess function
'to close all related processes to this handle. See the
'article for more information.
MsgBox "Handle still exists."
Else
'Handle does not exist.
MsgBox "Program closed."
End If
End Sub


-->untested code..I am working on these...
Let me start by thanking everyone for their suggestions and very helpful comments.  It seems this has become more complicated than originally intended.  My main goal was to automate the printing of a .pdf drawing WITHOUT USER intervention.  The only true problem I had was to close Adobe.  It has now become clear that adobe does not really handle command line printing in a manner that would be sufficient for me to use. Thanks antonieraj for your code, however all this has to be done automatically without a user to click.  This was my major headache.  The problem with the close app program is the same one I with the process viewer. Adobe must close before that line will execute. It seems adobe will "hang" until windows end task is initiated. To answer the printer question we have almost all hp's from 820c - hp5000.  I am trying to get this resolved quickly to distribute points for you hard work, however there is only so much time in my day. I must admit my experience in this area is limited, but that is why I am using this forum.  Thanks again for all your suggestions.
I thought  I would add my flow of the process that it may help.

1. a user scans a card with a part number.

2. The AS/400 then invokes a pc program to print a pdf document passing that program 3 parms.
    The parms being Printer, Directory, Filename.

3.  The PC program accepts in the 3 parms, prints the .pdf file, and releases control and exits the program, thus
     allowing the 400 to complete.

The fact that you are using different printer types will make the Ghostscript based solution more complicated, because you need to switch the GS output format depending on the printer. Have you downloaded the eval version of Batch&Print Pro?
One other option would be to install a CUPS print server (http://www.cups.org). This print server can print PDF documents. It does use Ghostscript in the background, but you are presented with a nice configuration web page and don't have to deal with the Ghostscript setup yourself. Cups runs on pretty much any Unix system. Your script would spool the PDF file to a print queue (again, this can be done with command line lpr), and Cups would take care of converting PDF to the printer format and sending this data to the printer.

Our platform is windows 2000.  I have downloaded batch&print pro, but the documentation for any use of a batch file is limited. I am looking into that now.
In order to print and exit acrobat properly, you'll need Acrobat 4
After compile this, just "pdfprint a.pdf", it will wait until acrobat(or reader) finish print,
then try to close acrobat by sending message WM_CLOSE.

If acrobat has activated and opened some document before run pdfprint,
pdfprint will wait until finish print, buy won't try to close acrobat.

my english poor, if any question please let me know.
 
---------------------------
#include <stdio.h>
#include <windows.h>

HWND hTMPWnd;

void WINAPI LogErr()    
{
  LPVOID lpMsgBuf;

  FormatMessage(
      FORMAT_MESSAGE_ALLOCATE_BUFFER |
      FORMAT_MESSAGE_FROM_SYSTEM |
      FORMAT_MESSAGE_IGNORE_INSERTS,
      NULL,
      GetLastError(),
      MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
      (LPTSTR) &lpMsgBuf,
      0,
      NULL
  );

  MessageBox (NULL, (const char *)lpMsgBuf, "a",MB_OK) ;
  LocalFree( lpMsgBuf );
}

BOOL CALLBACK EnumCallBack(HWND hwnd, LPARAM lParam)
{
  char s[255];
 
  GetWindowText (hwnd, s, 255);
  if (strstr(s, (char *)lParam)) {
    hTMPWnd = hwnd;
    return FALSE;
  }
  else
    return TRUE;

}

HWND FindSubWnd(char * szWnd)
{
  EnumWindows (EnumCallBack, (LPARAM)szWnd);
  return hTMPWnd;

}

int main(int argc, char* argv[])
{
  char szFile[1024];
  DWORD size=1024;
  SHELLEXECUTEINFO ei;
  HWND hWnd;
  int i;
  char szAdobe[255];
  char szAdobeDoc[255];

 
  ZeroMemory( &ei, sizeof(ei) );
  ei.cbSize = sizeof(ei);

  if (argc < 2)
    return FALSE;

  // Get the path to the viewer executable and launch it.
  ZeroMemory (szFile, 1024);
  FindExecutable(argv[1], NULL, szFile);
  if (!szFile[0])
    return FALSE;
  printf ("Acrobat: %s\n", szFile);
  if (strstr(szFile, "AcroRd32"))
    strcpy (szAdobe, "Adobe Reader");
  else
    strcpy (szAdobe, "Adobe Acrobat");


  ei.fMask = SEE_MASK_FLAG_DDEWAIT ;
  ei.lpVerb = "print";
  ei.lpFile = argv[1];
  ei.nShow = SW_HIDE;


  hWnd = FindSubWnd (szAdobe);
 
  ShellExecuteEx (&ei);

  strcpy (szAdobeDoc, szAdobe);
  strcat (szAdobeDoc, " - [");
  strcat (szAdobeDoc, argv[1]);
  strcat (szAdobeDoc, "]");
  if (!hWnd) {
    //LogErr();
    //WaitForInputIdle(ei.hProcess,INFINITE);
    Sleep(10000);

    for(i=0; i<1000; i++) {
      Sleep(1000);
      hWnd = FindWindow(NULL, szAdobeDoc);
      printf ("Find Window: %d\n", hWnd);
      if (!hWnd) {
        SendMessage (FindWindow(NULL, szAdobe), WM_CLOSE, 0, 0);
        goto Final;
      }
    }
  }
  else {
    Sleep(10000);

    for(i=0; i<1000; i++) {
      Sleep(1000);
      hWnd = FindWindow(NULL, szAdobeDoc);
      printf ("Find Window: %d\n", hWnd);
      if (!hWnd) {
        goto Final;
      }
    }
  }

Final:
 
  fclose(fopen("Finish", "w"));
  //LogErr()
      return TRUE;

 

}
It may be too late for another suggestion here, but maybe someone will find it useful.  :)

It sounds to me like the batch file printing was already working really well except for the problem of having the batch file hang until Acrobat exits.  Why not start Acrobat Reader with this command?

start acrord32.exe /p /h c:\shop\shop\PD-58491A-A.Pdf

The start command will cause the batch file to continue execution without waiting for Acrobat Reader to exit.

-- Mark
I have also run into this problem at work... on a windows 2000 or xp machine.. can't remember.. anyways.. it seems that since Acrobat 5.0, adobe does not support the undocumented command /t.. that seems odd to me because they include it in file type printto command in windows.  But then again that could be from me upgrading to 6.0.

The one solution that I have found did not make me happy but is supported.  You simply have to get your hands on an Acrobat 6.0 sdk, which I have not yet found for free..

And program using the API to print from a command line.

Personally there should be a freeware way around this.  Especially for something this simple.

Then again.. it's my company's problem and not mine.  I would just use linux and I'm sure there's something there.  These people are just afraid of anything not windows based.  I guess I should leave it at that.  I'll post more info if I get any but somebody should make a simply pdf print program in c using the acrobat sdk and send it out as freeware and put the link on here..

That would be nice.. and if I have to.. if legal that is.. I would do so... but first I need to find a copy of the SDK..

Mettedraq....

p.s. anything that could help out here as a freeware solution would be gladly accepted by me.. :)

Download the Acrobat 5 SDK, it's still available for free. Almost everything from the v5 SKD will work with Acrobat 6. Get it as long as it's still free.
I have been wrestling with the same problem for a few days now. My students send their print jobs as PDF files to a Windows Print Server connected to a Ricoh AP204 color laser printer. All of the students use iMacs running OS X (10.3.6) and there is no acceptable PPD file from Ricoh to allow them to print directly to the AP204 (the problem seems to be that OS X wants to send PS Type 3 commands and the Ricoh only accepts PS Type 2). We got around this by using OS X's ability to save any file in PDF format. I shared a folder on the Windows Print Server and needed a daemon to examine the folder and, when it found files there, print them and then delete them.

This turned out to be rather complicated. However, I came up with a solution using Windows Scripting and a shell extensions ActiveX control written by G. Born (credit is given in the script). The solution uses two three known directories on the Windows Print Server:
1. The script directory
2. The PDF file directory (shared)
3. The Printed file directory (PDFs are moved from (2) as they are printed
The solution runs in an infinite loop and does three things:
1. It deletes any files in the Printed directory and waits 10 seconds
2. It  copies any PDF files found in the PDF directory to the Printed directory and prints them
3. It waits five minutes and then starts over again
The values for the directories and timeouts are easily modified.

The requirements are noted in the script: I use Adobe Reader 6.0.2 and G. Born's ShellExtension.ocx (it can be downloaded from: http://ourworld.compuserve.com/homepages/Guenter_Born/WSHBazaar/WSHExtend.zip along with some very illuminating scripts).

If you need to kill the script it is listed in the Task Manager Processes window as wscript.exe

' Filename:      PrintPDF.vbs
'
' Author:      Br. David Carlson
' Modified:      Wade Eilrich
'
' Reference:      Based partially on nimbdascan.vbs by Brian J. LaSitis
'                 and Linux vcremove by Br. David Carlson. Also uses
'                 the ActiveX control for ShellExtension.ocx written
'                 by G. Born
'
' Date:            01/25/04
'
' Revised:    02/13/04 to keep a separate log file for each of the drives scanned. - Br. David
'               11/13/04 copy, print, log, delete PDF files - Wade Eilrich
'
' Description:      This script scans the C (and any other drives - see end of
'            file) drive(s) for PDF files in TBP directories. It then
'            prints any files it finds and then deletes them to reclaim
'            disk space. The files removed have the form: *.pdf
'               These files are created by students when they want to print
'            from a Mac OS X system to a non-Mac printer.
'            This script should be scheduled to be run on a periodic
'            basis using the AT command.
'
' Assumptions:      The scripts all reside in the C:\MyScripts directory
'            The files all exist in the TBP directory
'            The files are have the .PDF extension
'            The printed files are moved to C:\Printed
'            We create a temporary files called pdf.tmp in the MyScripts directory
'            We create a log file called pdflog.txt in the MyScripts directory
'
' Requirements: ShellExtension.ocx ActiveX Control
'            Acrobat Reader must be installed
'            ShellExtension.ocx is in the MyScripts directory and has been registered
'            using regsvr32 C:\Myscripts\ShellExtension.ocx
'


Option Explicit

Dim cTarget


Sub PrintPDFDirectory(cTarget)
   Const cScriptPath = "c:\MyScripts"   ' Adjust this location as desired.
   Const DeleteReadOnly = True
   Const OpenFileForReading = 1
   Const OpenFileForWriting = 2
   Const OpenFileForAppending = 8

   Dim oShell, fso, tsInFile, tsOutFile, tsFileName, cDir, app, qt, prn, port
   Dim oShExt, code, prnFile, path
   Dim cy, cm, cd, ch, cs, cmin, dt


   'On Error Resume Next        ' not safe in an infinite loop

   Set oShell = WScript.CreateObject("WScript.Shell")
   Set oShExt = WScript.CreateObject("ShellExtension.ShellObjects")

   ' Produce the list of files:

   cDir = Left(cTarget, 1)

   ' Example of how to use different file specifications
 '  oShell.Run "%comspec% /c dir " & cTarget & "*.obj " & cTarget & "*.ilk " & cTarget & "*.pch " & cTarget & _
 '     "*.pdb " & cTarget & "*.idb /s /b > " & cScriptPath & "\vc.tmp", 0, True
 
   ' We are only looking for PDF files
   oShell.Run "%comspec% /c dir " & cTarget & "*.pdf /s /b > " & cScriptPath & "\pdf.tmp", 0, True

   ' Print the files:

   ' Open the text file that contains the directory listing
   ' Put the drive letter into the filename.
   Set fso = WScript.CreateObject("Scripting.FileSystemObject")
   Set tsInFile = fso.OpenTextFile("pdf.tmp")
   Set tsOutFile = fso.OpenTextFile("pdflog" & ".txt", OpenFileForAppending, True)  

   Do While Not tsInFile.AtEndOfStream

      tsFileName = tsInFile.ReadLine

      ' Example of looking at multiple directories for files
'     if (instr(1, tsFileName, "\Debug\", vbTextCompare) > 0) or _
'        (instr(1, tsFileName, "\Release\", vbTextCompare) > 0) then
'        tsOutFile.WriteLine("Deleting: " & tsFileName)

      ' Examine the files in the TBP directory
      ' Print any PDF files found
      if (instr(1, tsFileName, "\TBP\", vbTextCompare) > 0) then

       ' Move the file to the PRINTED directory
         ' It must NOT be a subdirectory of the TBP directory
       prnFile = fso.GetFileName(tsFileName)
       prnFile = "C:\Printed\" & prnFile    ' modify this as necessary
       fso.MoveFile tsFileName, prnFile

         ' Print the file
       code = oShExt.WSHShellExecute("print", prnFile, 1, 1, true)

         ' Log success and errors
       cy = Year(Now)
       cm = Month(Now)
       cd = Day(Now)
       ch = Hour(Now)
       cs = Second(Now)
       cmin = Minute(Now)
         dt = cm & "-" & cd & "-" & cy & " " & ch & ":" & cmin & ":" & cs & " "
         if code > 32 then
            tsOutFile.WriteLine(dt & prnFile & "Printed")
         else
            tsOutFile.WriteLine(dt & prnFile & "Error-" & code)
         end if

       ' Close the Adobe Reader application
         ' First, wait for Reader to open, activate it (to bring it into the foreground)
         ' Finally send it ALT-F4 to close it
         wScript.Sleep(5000)       ' adjust this value as needed
       oShell.AppActivate "Adobe Reader"
       oShell.SendKeys "%{F4}"

     end if
   Loop


   ' Clean up
   tsInFile.Close
   tsOutFile.Close
   Set tsOutFile = Nothing
   Set tsInFile = Nothing

   ' Delete the temporary file, but NOT the log file
   fso.DeleteFile("pdf.tmp"), DeleteReadOnly

   Set oShell = Nothing
   Set oShExt = nothing
   Set fso = Nothing
End Sub

Sub ClearDirectory(cTarget)
   Const FO_DELETE = &H3
   Const FOF_ALLOWUNDO = &H40
   Const FOF_FILESONLY = &H80          '  on *.* (do only files - not directories)
   Const FOF_NOCONFIRMATION = &H10     '  No user prompt

   Dim source, destin, oShExt, code
   source = cTarget
   destin = cTarget

   Set oShExt = WScript.CreateObject("ShellExtension.ShellObjects")
   code = oShExt.WSHFileOperation(FO_DELETE, source, destin, FOF_FILESONLY + FOF_ALLOWUNDO + FOF_NOCONFIRMATION)

   ' Further improvements might include writing failure information to the log
   ' if code <> 0 Then
     ' MsgBox "Deletion error: " & code
   ' end if

   Set oShExt = nothing
End Sub

' Main program loop
' Delete all the files in the PRINTED directory
' Wait 10 seconds
' Print PDF files in the C:\TBP (To Be Printed) directory
' Wait 5 minutes and repeat forever
Do
   ClearDirectory "C:\Printed\*.pdf"
   wScript.Sleep(10000)
   PrintPDFDirectory "C:\tbp\"
   wScript.Sleep(300000)
Loop

--weilrich