WatchDirectory Forum
http://www.watchdirectory.net/cgi-bin/yabb25/YaBB.pl
watchDirectory forums >> How to... >> Example of variable use in v4 email plug-in
http://www.watchdirectory.net/cgi-bin/yabb25/YaBB.pl?num=1127422374

Message started by fivespan on Sep 22nd, 2005 at 10:52pm

Title: Example of variable use in v4 email plug-in
Post by fivespan on Sep 22nd, 2005 at 10:52pm
I want to watch a folder for changes to sub-folders (not files). The email should be sent out once a day with all the changes for the previous 24 hrs.

What are the values for the plugin  "Enter the message Body" when I want to receive:

MESSAGE:

The following folders were ADDEED to the file server in the last 24hrs:
\\server\pathpart1\pathpart2\JustMadeFolder1
\\server\pathpart1\pathpart2\JustMadeFolder2
\\server\pathpart1\pathpart2\JustMadeFolder3
\\server\pathpart1\pathpart2\JustMadeFolder4
\\server\pathpart1\pathpart2\JustMadeFolder5
\\server\pathpart1\pathpart2\JustMadeFolder6
\\server\pathpart1\10000\JustMadeFolder7

The following folders were DELETED from the file server in the last 24hrs:
\\server\pathpart1\pathpart2\DeletedFolder1
\\server\pathpart1\pathpart2\DeletedFolder2

The following folders were RENAMED on the file server n the last 24hrs:
\\server\pathpart1\pathpart2\NewName1 -- OldName
\\server\pathpart1\pathpart2\NewName2 -- OldName

------

Any ideas for me?

Title: Re: Example of variable use in v4 email plug-in
Post by Gert on Sep 24th, 2005 at 11:39am
Hello "Fivespan",

The email plugin does not support this directly, but you can use the .bat file plugin (http://www.watchdirectory.net/wdhelp/plugins/wdopAutoRunBat.html) to script a solution.

Create a .bat file like this:

Code (]
:DIRNEW
echo ADDED %WD_FILE% >> C:\Temp\diractivity.txt
GOTO :EOF
:DIRDEL
echo REMOVED %WD_FILE% >> C:\Temp\diractivity.txt
GOTO :EOF
:DIRREN
echo RENAMED %WD_FILE% - %WD_OFILE_N% >> C:\Temp\diractivity.txt
GOTO :EOF
[/code):



and let WD run it for "directory events" (http://www.watchdirectory.net/wdhelp/help/wdnewconfigpage4.html).

Create another .bat file that sends the diractivity.txt file, containing
[code]
set EMAILFILE=C:\Documents and Settings\All Users\Application Data\watchDirectory\System.Mail\Out\TTT.TMP
echo this is the subject > "%EMAILFILE%"
echo John Doe^<j.doe@johndoe.com^> >>  "%EMAILFILE%"
echo. >> "%EMAILFILE%"
echo. >> "%EMAILFILE%"
echo c:\temp\diractivity.txt >> "%EMAILFILE%"
echo pecunia non olet >> "%EMAILFILE%"
echo Hello, >> "%EMAILFILE%"
echo Please find attached the file with changes >> "%EMAILFILE%"
rem okay, the script is created, now rename it so the wdPostMan program processes it.
ren "%EMAILFILE%" TTT.wdmail


See http://www.watchdirectory.net/wdhelp/plugins/wdopAutoRunBatEmail.html for an explanation of this script.

This "send email script" should not be run by WD, but scheduled by the windows scheduler to run once a day.

Hope this helps,
Gert

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