Read Data From Table :: Find Files :: Print Files - How?

  • I am having a bit of a difficult time trying to figure how to design this DTS package.  Here is what I would like my DTS to do:

     1. Query database table for FILE_NAME

     2. Find FILE_NAME in a directory and its subdirectories.

     3. After finding FILE_NAME, Print it.

    So far I have this:

    '**********************************************************************

    '  Visual Basic ActiveX Script

    '************************************************************************

    Function Main()

         strDir = "C:\temp"

         

         Set objFSO = CreateObject("Scripting.FileSystemObject")

         Set objDir = objFSO.GetFolder(strDir)

         Set objShell = CreateObject("Shell.Application")

         Set objFolder = objShell.Namespace(strDir)

         Set colItems = objFolder.Items

         getInfo(objDir)

         Set objFSO = nothing

         Main = DTSTaskExecResult_Success

    End Function

    Sub getInfo(pCurrentDir)

         For Each objItem In pCurrentDir.Files

         MsgBox objItem.Name

            If LCase(Right(Cstr(objItem.Name), 3)) = "pdf" Then

            'objItem.InvokeVerbEx("Print")

            End If

    Next

    For Each aItem In pCurrentDir.SubFolders

       MsgBox objItem.Name & " passing recursively"

             

       getInfo(objItem)

          

    Next

    End Sub

    Any and all assistance will be greatly appreciated.

  • Since you're trying to print a PDF file, is Acrobat Reader or a print driver for PDF's installed on the server?

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.
    "Change is inevitable... change for the better is not".

    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)
    Intro to Tally Tables and Functions

  • My question, is not so much about printing PDFs - this functionality works fine.  I am more concerned about:

    1. Getting the fields from the database
    2. Finding those files in a directory/subfolders

    Thanks for your asssistance!

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply