WatchDirectory Forum
http://www.watchdirectory.net/cgi-bin/yabb25/YaBB.pl
watchDirectory forums >> Plugins >> Starting multiple .bat files
http://www.watchdirectory.net/cgi-bin/yabb25/YaBB.pl?num=1227566146

Message started by matt555 on Nov 24th, 2008 at 11:35pm

Title: Starting multiple .bat files
Post by matt555 on Nov 24th, 2008 at 11:35pm
Hopefully this has not been posted elsewhere, I searched for it quickly and did not see anything relevant to my inquiry.

I was curious if it is possible to run a new batch file once it is created within the specified directory. I have a web screen that give available folders containing zip files to process (checkboxes). Once decided upon, the user can select what directories they want to process and a batch file will be created for that specific folder to be processed. The problem is, that in order to prevent overwriting of files, they have an incremental number, as well as a timestamp on the end (for example: fire1-1227301458.bat). All the batch file contains is a simple php call that will run for the specific folder (they need to be run one at a time).

Thank you to anyone that can offer any help, I'm hoping that this program will offer us the solution that we are looking for.  ;)
ScreenShot004.jpg (26 KB | )

Title: Re: Starting multiple .bat files
Post by Gert on Nov 25th, 2008 at 7:05am
Hello Matt,

Yes, that should be possible.

* Use the "run a .bat file" plugin ( http://www.watchdirectory.net/wdhelp/plugins/wdopAutoRunBat.html ) and configure it to run the bat script below (startfire.bat)
* On the "events" page, only select the FILENEW event ( http://www.watchdirectory.net/wdhelp/help/wdnewconfigpage4.html )
* On the "filter events" page ( http://www.watchdirectory.net/wdhelp/help/filter_events.html ) create a filter so it will only start for your generated bat files,
 for example, create a filter "file name matches fire*.bat"


Here is the script. Save it somewhere on your C: drive as "startfire.bat"
[code]
rem make sure we are called for a batch script
IF "%WD_FILE_E%" NEQ "BAT" GOTO :EOF
rem call the batch script
CALL "%WD_FILE%"
rem if you want to delete the script once its ready, remove the REM on the next line
REM DEL "%WD_FILE%"
[/code]


Gert

Title: Re: Starting multiple .bat files
Post by matt555 on Nov 25th, 2008 at 4:31pm
Awesome!!! Thanks a million. You just saved me the biggest headache of having to look for a different solution.

Thanks Again!

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