Pages: 1
RSS
Removing part of the attachment name ?
 
I am using TheBat! (and it works successfully) to grab files from a folder, make the file into the attachment, and then send the file by email, to the email address that is in part of the file name, for example: alex111@hotmail.com~~mylifestory.txt.

It works with the help of the files shown below.

My question is; can these files be modified to do the following: After TheBat! puts the email address portion of the file name into the Send To: line,
can TheBat! remove the email address (and ~~) from the file name, (the attachment name), so that the attchment is just named mylifstory.txt?


Currently using these:
Sendfile.cmd:
For %%i in ("C:\Documents and Settings\Desktop\BAT\XXX\­*.txt") do "C:\Program Files\The Bat!\thebat.exe" /MailT="C:\Documents and Settings\Desktop\BAT\Send­file.tpl";A="%%i";To="%%i­";Send

And a Sendfile.tpl:
%SetPattRegExp='C:\\Docum­ents and Settings\\Desktop\\BAT\XX­X\\(.*?)~~(.*?)\.txt'%-
%RegExpBlindMatch='%To'%-­
%ModifyOnce(To)%-
%SetHeader(To,%SubPatt='1­')%-
%Subject="Hello."
Hi %ABToFirstName="%ToFName"­,
Thank you.
Regards, %FromFName

And this Sorting Office template:
copy "C:\Documents and Settings\Desktop\BAT\XXX\­%Attachments"
"C:\Documents and Settings\brian\Desktop\BA­T\Sent"
del "C:\Documents and Settings\Desktop\BAT\XXX\­%Attachments"

T
 
TB can't rename attached files, so you'd need to rename the file before it's attached.  
__________________________________
I'm just a user of The Bat! I don't work for Ritlabs.
 
Thank you for your kind reply.

I now understand that TheBat! cannot rename an attachment.

Can you tell me please, is it possible that TheBat! can do the following:

instead of copying the email address portion of the file name, to the "Send To" line, can TheBat! cut (delete) the email portion of the file name and add it to the "Send To" line?

I look forward to your reply. Thanks again.
 
No, as far as TB is concerned your file doesn't exist until your script is calling TB and sets the file as attachment.
So the name changing part has to be done by your script, but when you change the file name before TB attaches it, that file name won't include the address, so the link between what file you sent to whom is lost when you copy the file to your 'sent' directory.

So in stead of giving bits of a puzzle you might just give the whole story. You want to send files automatically.
How do you generate these files, are they always the same files?
You're naming these files with the address and a file name. Is it possible to let the generating program create a .cmd file too, in stead of the clumsy construct you're using now. (It looks familiar, I even might have helped you with it.)
How do you retrieve these addresses? Is it possible for TB to do that in a better way?
__________________________________
I'm just a user of The Bat! I don't work for Ritlabs.
Pages: 1