Pages: 1
RSS
Automate send attachments, Send selected files to a address
 
Hello

Currently I use Total Commander (TC) file manager.
It allows you to create buttons which activate commands

What I would like to do

1 Select the files I want to send as attachments in 'TC'

2 Press button to call  'thebat message editor'
 The button would contain the send to address

Is this possible

Regards  
 
It's possible.

Create two files with following content

File - tb.vbs
Quote

'=========================================================
acc_name="my_account" 'here is account name
fld_name="Outbox" 'here is folder name
subj = "Here some files to send" 'here is the message subject
tpl_file="C:\APack\TheBat\_Test\att.tpl" 'path to template file
need_pack=1 'set: 0 - do not pack, 1 - pack with rar
email = "" 'set: "" - ask email, other will be placed in "TO" field
rar_exe = "C:\APack\TotalCommander\Util\RAR\Rar.exe" 'path to RAR
temp_folder = "c:\Temp" 'path to temp folder
'=========================================================

set WSHShell = WScript.CreateObject("WScript.Shell")
tb_exe = WSHShell.RegRead("HKCU\Software\RIT\The Bat!\EXE path")

Command = tb_exe & " /MAILU=" & acc_name & ";F=" & fld_name & ";S=""" & subj & """;"

if email = "" then
 email = InputBox("Enter Email")
 Command = Command & "TO=""" & email & """;"
else
 Command = Command & "TO=""" & email & """;"
end if


set fso = WScript.CreateObject("Scripting.FileSystemObject")
set file = fso.OpenTextFile(temp_folder & "tb_files_to_send.txt", 2, true)
set Args = Wscript.Arguments

if need_pack=1 then
 arc_file = temp_folder & "files.rar"
 if fso.FileExists(arc_file) then
fso.DeleteFile(arc_file)
 end if

 pack_command = rar_exe & " a " & arc_file
 for i=0 to args.count-1
   pack_command = pack_command & " """ & args(i) & """"
 next
 file.WriteLine "files.rar"
 for i=0 to args.count-1
   file.WriteLine "- " & args(i)
 next

 WSHShell.Run pack_command, 1, true
 command = command & "A=""" & temp_folder & "files.rar" & """;"
   
else
 for i=0 to args.count-1
   command = command & "A=""" & args(i) & """;"
   file.WriteLine args(i)
 next
end if

Command = command & "T=""" & tpl_file & """;"

WSHShell.Run command, 1, false

file - att.tpl

Quote

Hello, %IF:"%ABTONAME"="":"%TOFName":"%ABTONAME"

See files attached:
%PUT="c:\Temp\tb_files_to_send.txt"

--
Best regards,
%FromFName                          mailto:%FromAddr

This is automatically generated message from The Bat! v.3
%BCC="" %BCC="%ABTONAME <%TOADDR>" %TO="" %TO=%BCC %BCC=""

Fill header part of file tb.vbs with your local paths and names.

Correct template file(att.tpl) if you need.

Place file in "Send To" folder to have this command in right-click menu in Total.  
Place tb.vbs in your Total's toolbar and choose proper icon for it.

All questions and suggestions are welcome.

P.S. Sorry for strange symbols in my name and for my bad english.
 
Thanks for help

Fill header part of file tb.vbs with your local paths and names

C:\Program Files\The Bat! is TB folder
All data is stored in <default> -(don't know where TB stores it)
My attempt at filling out header information
======================================================
acc_name="Sigi & Denneise"
fld_name="C:\Program Files\The Bat\Outbox"(outbx in <default> )
subj = "%ATTACHMENTS"  
tpl_file="C:\Program Files\TheBat\att.tpl"
need_pack=0
email = other 'set: "" - ask email, other will be placed in "TO" want to send to'steve'
rar_exe = "C:\TotalCommander\Util\RAR\Rar.exe"
temp_folder = "c:\Temp\"
======================================================

'steve' is an entry in adress book
it has an associated message template

How do  I associate address book entries ('steve') with the 'tb.vbs' file you gave me

Kind Regards
Sigi





 
Quote
fld_name="C:\Program Files\The Bat\Outbox"
I think you should write "Outbox" only.


Quote
email = other
you shoud write steve's email  
email = "steve@host.com"

And from template
(Hello, %IF:"%ABTONAME"="":"%TOFName":"%ABTONAME")
addressbook entries will be used.
Pages: 1