Monitor Folder for new files then Print Them

Posted on 2012-09-15
Last Modified: 2012-09-16
Hi guys,

I have a folder that I need to monitor, and as soon as a new file is added, mainly clear text files, I need to print them to the default printer. I am running this on Windows Server 2008 R2.

I found a script on this site which is attached as test2.vbs that does exactly what I need but its giving me an error and since I am not much of a scripting guy I though you might help me.

Its giving me the error attached as error.png

It was suggested to me that above this line: Set objFolder = objShellApp.Namespace(objFile.Parent)

I add: WScript.Echo "Found " & objFile.Path

and see whether the path if a full UNC path.

The result is attached as capture.png.

Can someone help me solve this?
Question by:mbusuttil
    LVL 28

    Assisted Solution

    Printfile -

    Chris B
    LVL 12

    Expert Comment

    LVL 51

    Expert Comment

    by:Bill Prew
    LVL 65

    Accepted Solution

    Oh I see the problem!  Change this line:
    	Set objFolder = objShellApp.Namespace(objFile.Parent)

    Open in new window

    to this
    	Set objFolder = objShellApp.Namespace(objFile.ParentFolder)

    Open in new window



    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    The problems with reply email signatures

    Do you wish that you could place an email signature under a reply? Well, unfortunately, you can't. That great Exchange/Office 365 signature you've created will just appear at the bottom of an email chain. What a pain! Is there really no way to solve this? Well, there might be...

    Redirected folders in a windows domain can be quite useful for a number of reasons, one of them being that with redirected application data, you can give users more seamless experience when logging into different workstations.  For example, if a use…
    Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
    This tutorial will show how to push an installation of Backup Exec to an additional server in both 2012 and 2014 versions of the software. Click on the Backup Exec button in the upper left corner. From here, select Installation and Licensing, then I…
    This tutorial will walk an individual through the steps necessary to configure their installation of BackupExec 2012 to use network shared disk space. Verify that the path to the shared storage is valid and that data can be written to that location:…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now