I have a script that does something similar to what you want to do. The
script uses a polling rule to watch the directory.  The code is as
follows:

 

If Step = "POLL" Then

        If Rule("") Then

            F("FileName") = Dir("c:\bss70\data\*.txt")

            Step = "FILEEXIST"

            Exit Sub

        End If

    ElseIf Step = "FILEEXIST" Then

        If Rule("F(""FILENAME"")<>") Then

            F("FileName") = "c:\bss70\data\" & F("FileName")

            Step = "PROCESS APP"

            Exit Sub

        End If

        If Rule("F(""FILENAME"")=") Then

            Wait 30

            Step = "POLL"

            Exit Sub

        End If

 

Basically it will assign any filename that exists in the directory to a
flag.  If the flag does not equal "" then it goes to step FILEEXIST to
process the file.  If the flag does = "" then it will wait 30 seconds
and poll again.

 

Hope this helps.

 

Stephen Smesny

Programmer \ Analyst

Beaufort Memorial Hospital

[EMAIL PROTECTED]

843-522-7915

 

 

 

________________________________

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Lawrence,
Mitchell
Sent: Thursday, August 30, 2007 12:10 PM
To: [email protected]
Subject: [Talk] Method to watch a directory for a specific file
Importance: High

 

Is there a rules-based (or nice polished vba function) method for
watching a specific directory for a specific file?

 

I would like to incorporate printing to PDF from Meditech into our
scripting capabilities. I can do this by creating a pdf printer driver
(we have full adobe) that always prints to a specified directory,
specified file. During the creation of a PDF, adobe uses a .tmp file,
once the creation of the document is finished, adobe renames the .tmp
file to the actual PDF.

 

If I was able to "watch" the output directory for the file, I could then
pick that file up and move it to the proper destination/proper name, and
then close out the script.

 

So I would also need some way to turn off the timeout in BWS, as each
file may take some time to create and would be variable.

 

Anyone have any ideas for these two things? 

 

*       Watching a directory for a specified file (likely a vba
function/subroutine)
*       Turning off the timeout in BWS?

 

Thank you,

Mitch Lawrence

Lead Applications Analyst

Technical Support - NPR/Automation

CHRISTUS Information Management

*: [EMAIL PROTECTED]

 

 

Send a "thank you" <http://intranet.christushealth.org/spiritBuck/>  to
someone!

 


**********************************************************************
The information contained in this electronic communication, and any electronic 
attachment(s), is CONFIDENTIAL and is intended only for the named recipient(s) 
above. If the reader of this message is not the intended recipient(s), you are 
hereby notified that any release of information or distribution of this 
communication is prohibited by law. If you have received this message in error, 
or are not the named recipient(s), please immediately notify the sender via 
reply email and delete this communication.
 
**********************************************************************


This message was scanned with MIMESweeper.

<<image001.jpg>>

Reply via email to