Jump to content
Macro Express Forums

PDF still open


Recommended Posts

I have a macro that copies PDF file from one server to another.  The problem I am having is that sometimes a PDF file is still being copied to the server when the macro run.  

1. A document is scanned and saved as a PDF to server1

2. A macro runs every few minutes on server1 and copies the PDF to server2

3. Occasionally, at PDF is in the middle of being saved to server1 when the macro tries to move it to server2.  This causes a window error or even a corrupt PDF file.

Is there a way to tell is a PDF is ready to be moved?  The "IF file Ready" command won't work because it only test

Any ideas?

Move file one-at-a-time.mxe

Link to comment
Share on other sites

Try the Wait for File to be Ready command.

If Folder Exists: "\\SCANSERVERHOST\PPLImageDepot\Processing Temp"
  Repeat with Folder C:\Scans // PLow thru the folder
    Clear Variables
    Variable Set From File path // Get teh file extension
    Variable Set From File: Set to the Size of a File (C:\Scans\%File%)
    If File Exists: "C:\Scans\%File%"
      If Variable %Size% Is Greater Than "0"
       
        Wait for File to be Ready: C:\Scans\%File%
         
        Copy File/Files: "C:\Scans\%File%" to "c:\Scans Sav"
        Move File/Files: "C:\Scans\%File%" to "\\SCANSERVERHOST\PPLImageDepot\Processing Temp\%File%"
        On Error
          Catch Error: File could not be located
            Macro Stop
          End Catch Error
        End Error
      End If
    End If
  End Repeat
End If

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...