Pause for PDF

Discussion in 'AutoCAD' started by dlinford, Jan 19, 2005.

  1. dlinford

    dlinford Guest

    I have a VBA routine that plots to PDF files then it renames and moves the files to another location on disk.

    I have to wait until the PDF printer (Adobe Acrobat) is done printing before I can rename or move it. Right now I have an arbitrary Pause length of 3 seconds. Sometimes this is long enough and sometimes this isn't.

    Is there a way to pause until the PDF plotter is done? The problem is this is a seperate program that is not AutoCAD.

    Thanks in advance for your help.

    David
     
    dlinford, Jan 19, 2005
    #1
  2. dlinford

    TomD Guest

    Possibly trigger your file move with the EndPlot event?

    (I didn't think through that answer, fully, just my first thought.)
     
    TomD, Jan 19, 2005
    #2
  3. dlinford

    TomD Guest

    Nevermind........would likely leave you with the same problem, just taking
    much more time to get there.

    ......maybe use FileSystemObject and check the file status? I would think
    the file being open would be detectable, but I haven't tried any such
    operation.
     
    TomD, Jan 19, 2005
    #3
  4. dlinford

    dlinford Guest

    Here is my current code. It checks to see if the file is there and if it is readonly then it pauses 8 seconds.

    oPlot.SetLayoutsToPlot vLayoutList
    plotReturnValue = oPlot.PlotToDevice(pc3Current)

    tempLayoutPdfFilePath = tempPath + "\" + plotSheetNumber + "." + plotFileExt

    While Dir(tempAcrobatPathFile, vbDirectory) = ""

    Wend

    While Dir(tempPath + "\*.pdf", vbReadOnly) = tempAcrobatPathFile

    Wend

    pauseTimer (8)

    Name tempAcrobatPathFile As tempLayoutPdfFilePath
     
    dlinford, Jan 19, 2005
    #4
  5. Yep. Generate a "folder watcher" and either monitor the file's status or
    write events on the file's actions. Been while since I did it in vb6 - its
    a lot easier in .NET. Do a google or codehound and you should be able to
    get sample code on it.

    -- Mike
    ___________________________
    Mike Tuersley
    CADalyst's CAD Clinic
    Rand IMAGINiT Technologies
    ___________________________
    the trick is to realize that there is no spoon...
     
    Mike Tuersley, Jan 19, 2005
    #5
  6. dlinford

    MP Guest

    this may not work for your needs but there is the movefile api that you can
    use with the constant to only perform the move on reboot.

    Private Declare Function MoveFileEx Lib "kernel32" Alias "MoveFileExA"
    (ByVal lpExistingFileName As String, ByVal lpNewFileName As String, ByVal
    dwFlags As Long) As Long
    Private Const MOVEFILE_DELAY_UNTIL_REBOOT = &H4
     
    MP, Jan 19, 2005
    #6
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.