I have set up an action in theBat! with MAIL command parameters, thanks to a very helpful contributor, on this forum. The action extracts the file from a certain directory extract the file name (which is an email address) and sends the file as an attachment to the email address.
I was kindly provided two files to accomplish this action, a Template file and a Command file. These files successfully accomplish their intended purpose. However, I want the action to check and recheck this directory (Output Directory) for new files and send them as they come in. However, by setting up the action to recur every few minutes, the same files get sent over and over again.
So I set up an action under "Excecute these actions when event finishes", to Watch and Send and move the files to another folder after they are sent. That is successful in solving the issue of files getting sent over and over again, however, the problem is that the Output Directory gets cleared out every few minutes, and it clears the Template file and the Command file too.
So, I am looking for help to find a solution that might somehow keep the action from moving the Template and Command files out of the Output Directory, and just move all other files out, or somehow be able to place the Template and Command files in another folder and still execute the action.
Thank you for looking this over and considering to assist me. I'd greatly appreciate a provided solution. The Sendfile.cmd and the Sendfile.tpl are as follows:
For %%i in ("C:\Documents and Settings\My Documents\Output\*.txt") do "C:\Program Files\The Bat!\thebat.exe" /MailT="C:\Documents and Settings\My Documents\Output\Sendfile.tpl";A="%%i";To="%%i";S="%%i";Send
-----Start of Sendfile.tpl-------------
%SetPattRegExp='C:\\Documents and Settings\\My Documents\\Output\\(.*?)\.txt'%-
%RegExpBlindMatch='%To'%-
%ModifyOnce(To)%-
%SetHeader(To,%SubPatt='1')%-
Hi %ABToFirstName="%ToFName",
I hope you like this.
Regards, %FromFName
------End of Sendfile.tpl--------------
I was kindly provided two files to accomplish this action, a Template file and a Command file. These files successfully accomplish their intended purpose. However, I want the action to check and recheck this directory (Output Directory) for new files and send them as they come in. However, by setting up the action to recur every few minutes, the same files get sent over and over again.
So I set up an action under "Excecute these actions when event finishes", to Watch and Send and move the files to another folder after they are sent. That is successful in solving the issue of files getting sent over and over again, however, the problem is that the Output Directory gets cleared out every few minutes, and it clears the Template file and the Command file too.
So, I am looking for help to find a solution that might somehow keep the action from moving the Template and Command files out of the Output Directory, and just move all other files out, or somehow be able to place the Template and Command files in another folder and still execute the action.
Thank you for looking this over and considering to assist me. I'd greatly appreciate a provided solution. The Sendfile.cmd and the Sendfile.tpl are as follows:
For %%i in ("C:\Documents and Settings\My Documents\Output\*.txt") do "C:\Program Files\The Bat!\thebat.exe" /MailT="C:\Documents and Settings\My Documents\Output\Sendfile.tpl";A="%%i";To="%%i";S="%%i";Send
-----Start of Sendfile.tpl-------------
%SetPattRegExp='C:\\Documents and Settings\\My Documents\\Output\\(.*?)\.txt'%-
%RegExpBlindMatch='%To'%-
%ModifyOnce(To)%-
%SetHeader(To,%SubPatt='1')%-
Hi %ABToFirstName="%ToFName",
I hope you like this.
Regards, %FromFName
------End of Sendfile.tpl--------------