WatchDirectory Forum
http://www.watchdirectory.net/cgi-bin/yabb25/YaBB.pl
watchDirectory forums >> Plugins >> run .bat file
http://www.watchdirectory.net/cgi-bin/yabb25/YaBB.pl?num=1199969915

Message started by tomcoleman on Jan 10th, 2008 at 1:58pm

Title: run .bat file
Post by tomcoleman on Jan 10th, 2008 at 1:58pm
I have a directory called c:\statements

I have one rule that says when a zip file is inserted to that directory to extract the PDF files inside which works a treat.

So now i have inside that directory

C:\statments\test.bat
C:\statments\test1.pdf
C:\statments\test2.pdf
C:\statments\test3.pdf

I want watchdirectory to be able to tell when pdf files have been created then run my test.bat

I have tried several times settign this up but it doesnt seem to do anything.??

My batch file simply mails out the PDF files to its set users.

Heres the batch file code:

ren FOEL2003P*.pdf FOEL2003.pdf

mpack -s "Elite Derivatives Daily Statement" -c application/pdf -o statemen.msg test1.PDF
bmail -s 192.168.62.1 -t thomas.coleman@gmail.com -f administrator@elitederivatives.com -h -m statemen.msg
del STATEMEN.MSG

mpack -s "Elite Derivatives Daily Statement" -c application/pdf -o statemen.msg test2.PDF
bmail -s 192.168.62.1 -t thomas.coleman@gmail.com -f administrator@elitederivatives.com -h -m statemen.msg
del STATEMEN.MSG

ping -n 5 127.0.0.1 >NUL
bromley.cmd
EDLZip.cmd


ect.


ANY IDEAS??!?!?!?

Title: Re: run .bat file
Post by Gert on Jan 10th, 2008 at 2:14pm
Well, there can be 2 reasons it is not working...

1st: your batch file is not called by watchDirectory
My guess is this is not the problem, but you never know. Can you "right-click" the task in the WD Control Center, and select "view task history". Now double-click any line inside the history-viewer to see the detected files (pdf's).
"JoeVB" posted a good explanation how to use the history-viewer here: http://www.watchdirectory.net/cgi-bin/yabb2/YaBB.pl?num=1195680453/2#2

Are the events for your pdf files present?
If they are, continue below.
If they are NOT present, can you try to change the "monitoring method" ( http://www.watchdirectory.net/wdhelp/help/wdnewconfigpage3.html ) to Polling or Default

2nd: your batch file fails to run properly
Perhaps Windows "aborted" your batch file because of errors. To see if this is the case...
Make sure "capture output from .bat files" is checked
Make sure your bat file starts with "ECHO ON" (not echo OFF)
do a "test run"

The "capture output" option will write all output of your script, including Windows error messages to log files in the task-directory (one log file for each event). Inside the WD Control Center, choose "Tools -> Explore Task Directory". This opens Windows Explorer in the directory with your settings. Now open the sub-directory that has the name of your task. Inside are the log-files with your bat file output.
Examine those log files to see if your bat file ran as expected.

Hope this helps,
Gert


Title: Re: run .bat file
Post by tomcoleman on Jan 10th, 2008 at 2:20pm
thank you fixed it :)

Title: Re: run .bat file
Post by Gert on Jan 10th, 2008 at 2:28pm
Great. Just curious... what was the problem?

By the way, the log-files described above are automatically deleted after a few days (I believe 3 days), so you don't have to worry about your disk "filling up" if you leave "capture output" enabled.

Gert

WatchDirectory Forum » Powered by YaBB 2.5.2!
YaBB Forum Software © 2000-2017. All Rights Reserved.