WatchDirectory home page
WatchDirectory Startseite (Deutsche Version)
Site WatchDirectory (Français)
  Welcome, Guest. Please Login or Register
YaBB - Yet another Bulletin Board
   
  HomeHelpSearchLoginRegister  
 
Page Index Toggle Pages: 1
Run specific .vbs file via .bat (Read 2073 times)
zr11
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 1
Run specific .vbs file via .bat
Mar 12th, 2005 at 7:48am
 
I am looking for a solution using your program where the bat file that gets called is able to run a specific .vbs file based on the name of the file that has been created in the watched folder. What I mean in this:

1. Your program watches Folder C:\FOLDER

2. file NEWFILE.JPG is created in C:\FOLDER

3. Your pogram calls the bat DOIT.BAT and tells it the name of the new file created.

4. DOIT.BAT loads the executes the files NEWFILE.VBS based on the name of the created file.

For example if instead of NEWFILE.JPG that was created, it is say DOSOMETHINGELSE.JPG the the .vbs file that the bat would execute in the end would be DOSOMETHINGELSE.VBS

Is this possible with your software package and if so what would the bat for something like that look like??

Thanks,
Mark
Back to top
 
 
IP Logged
 
Gert
YaBB Administrator
*****
Offline



Posts: 2225
The Netherlands
Re: Run specific .vbs file via .bat
Reply #1 - Mar 12th, 2005 at 9:15am
 
Hello Mark,

Yes, that should be possible... The DOIT.BAT would look something like this:
Code:
@echo off

rem where are the .vbs files located (no trailling backslash)
SET VBSLOC=C:\VBSFILES

rem only process new files
IF "%WD_REASON%" NEQ "FILENEW" GOTO :Eof

rem the .vbs to call depends on the filename created
rem  WD_FILE_N contains the filename without path or extension
SET VBSTOCALL=%VBSLOC%\%WD_FILE_N%.VBS

rem check if the VBS exists
IF NOT EXIST "%VBSTOCALL%" GOTO :NoVbs

"%VBSTOCALL%"

GOTO :Eof


:NoVbs
rem perhaps call a default VBS file here?

 



Hope this helps,
Gert
Back to top
 

Gert Rijs - gert (at) gdpsoftware (dot) com
Blog: http://blog-en.gdpsoftware.com/
End Alzheimer's: http://www.alz.org&&...
WWW WWW GdPSoftware  
IP Logged
 
Page Index Toggle Pages: 1