<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
	<channel>
		<title>www.ritlabs.com [Topic: Can TB move a file, and send a link to it?]</title>
		<link>http://www.ritlabs.com</link>
		<description>New posts in Can TB move a file, and send a link to it? of  forum at www.ritlabs.com [www.ritlabs.com]</description>
		<language>en</language>
		<docs>http://backend.userland.com/rss2</docs>
		<lastBuildDateTag>Tue, 15 Apr 2008 23:38:29 +0300</lastBuildDateTag>		<item>
			<title>Can TB move a file, and send a link to it?</title>
			<description><![CDATA[<b><a href="http://www.ritlabs.com/en/forums/forum4/topic6074/message23240/">Can TB move a file, and send a link to it?</a></b> in forum <a href="http://www.ritlabs.com/en/forums/forum4/">The Bat! - Configuring the E-mail Client</a>. <br />
			replace C:\test in my example with C:\BAT\TA<br /><br />put the file template.tpl in C:\BAT\TA<br /><br />Then it should work, I tested it.<br />I use many such files to automate theBat(and other apps too) and they all work fine. <br />
			<i>15 April 2008 23:38:29, <a href="http://www.ritlabs.com/en/forums/">bigg one</a>.</i>]]></description>
			<link>http://www.ritlabs.com/en/forums/forum4/topic6074/message23240/</link>
			<guid>http://www.ritlabs.com/en/forums/forum4/topic6074/message23240/</guid>
			<pubDate>Tue, 15 Apr 2008 23:38:29 +0300</pubDate>
			<category>The Bat! - Configuring the E-mail Client</category>
		</item>
		<item>
			<title>Can TB move a file, and send a link to it?</title>
			<description><![CDATA[<b><a href="http://www.ritlabs.com/en/forums/forum4/topic6074/message23219/">Can TB move a file, and send a link to it?</a></b> in forum <a href="http://www.ritlabs.com/en/forums/forum4/">The Bat! - Configuring the E-mail Client</a>. <br />
			Thank you for your help.<br /><br />I tried this but it didn't work for me.<br />I may have the path incorrect. <br />
			<i>15 April 2008 03:18:01, <a href="http://www.ritlabs.com/en/forums/">Alex</a>.</i>]]></description>
			<link>http://www.ritlabs.com/en/forums/forum4/topic6074/message23219/</link>
			<guid>http://www.ritlabs.com/en/forums/forum4/topic6074/message23219/</guid>
			<pubDate>Tue, 15 Apr 2008 03:18:01 +0300</pubDate>
			<category>The Bat! - Configuring the E-mail Client</category>
		</item>
		<item>
			<title>Can TB move a file, and send a link to it?</title>
			<description><![CDATA[<b><a href="http://www.ritlabs.com/en/forums/forum4/topic6074/message23206/">Can TB move a file, and send a link to it?</a></b> in forum <a href="http://www.ritlabs.com/en/forums/forum4/">The Bat! - Configuring the E-mail Client</a>. <br />
			here is a vbs script I quickly adapted from one of the scripts I use with theBat. Save as a file with a .vbs extension<br /><br />
====code====
<pre>
'---- EDIT HERE -------------------------------
myDir = "C:&#92;&#92;test"
baseUrl = "http://server/test/"
'
'assumes local dir C:&#92;&#92;test is mapped as test for your server,
'so a local path like 
'C:&#92;&#92;test&#92;&#92;dir&#92;&#92;file.txt
'translates to a URL like
'http://server/test/dir/file.txt

tbPath = "C:&#92;&#92;Program Files&#92;&#92;The Bat!&#92;&#92;thebat.exe"

tbAcc = "ACCOUNT" 'replace with the name of an existing account
'----------------------------------------------

template = myDir &#38; "&#92;&#92;template.tpl"
tmpTemplate = myDir &#38; "&#92;&#92;tmp.tpl"

Set wshShell = WScript.CreateObject ("WSCript.shell")
Set fso = CreateObject("Scripting.FileSystemObject")

For each file in fso.GetFolder(myDir).Files 
&nbsp;&nbsp;&nbsp;if right(file,4) = ".txt" then
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fname = fso.GetFileName(file)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'file name, no path
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;rec = left(fname, instr(1, fname, "~") -1 ) &nbsp;&nbsp;&nbsp;'recipient
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;user = left(rec, instr(1, rec, "@") -1 )&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'username
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'msgbox rec
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;newDir = myDir &#38; "&#92;&#92;" &#38; rec
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if not fso.folderExists(newDir) then fso.createFolder(newDir)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;newFile = newDir &#38; "&#92;&#92;" &#38; fname
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if fso.fileExists(newFile) then fso.deleteFile(newFile)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fso.moveFile file, newFile
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;url = baseUrl &#38; rec &#38; "/" &#38; fname
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'--read main template
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tmp = fso.OpenTextFile(template,1).readAll

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'-- create temp. template -------
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tmp = replace(tmp, "&#60;&#60;_recipient_&#62;&#62;", rec)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tmp = replace(tmp, "&#60;&#60;_url_&#62;&#62;", url)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tmp = replace(tmp, "&#60;&#60;_user_&#62;&#62;", user)

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Set a = fso.CreateTextFile(tmpTemplate, True)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;a.WriteLine(tmp)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;a.Close

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'send command to theBat, to create a message based on tmpTemplate 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;myCMD = "/MAILU=" &#38; tbAcc &#38; ";T=" &#38; chr(34) &#38; tmpTemplate &#38; chr(34) &#38; ";QUEUE"
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wshShell.run chr(34) &#38; tbPath &#38; chr(34) &#38; " " &#38; myCMD
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;WScript.Sleep(2000) 'ensure command is executed, sleep 2 seconds

&nbsp;&nbsp;&nbsp;end if
Next

'now messages are queued in Outbox, un-comment line below for sending
'wshShell.run chr(34) &#38; tbPath &#38; chr(34) &#38; " /SENDALL"

Set fso = Nothing
Set wshShell = Nothing
</pre>
=============
<br /><br /><br />and here is the template file template.tpl, save it in <br />myDir folder(as defined above)<br />
====code====
<pre>
Hi &#60;&#60;_user_&#62;&#62;,

here is your file
&#60;&#60;_url_&#62;&#62;

Regards,
yournamehere

%TO="&#60;&#60;_recipient_&#62;&#62;"
%SUBJECT="test"
</pre>
=============
<br /><br />it should be easy to customize it to do what you need <br />
			<i>13 April 2008 01:27:10, <a href="http://www.ritlabs.com/en/forums/">bigg one</a>.</i>]]></description>
			<link>http://www.ritlabs.com/en/forums/forum4/topic6074/message23206/</link>
			<guid>http://www.ritlabs.com/en/forums/forum4/topic6074/message23206/</guid>
			<pubDate>Sun, 13 Apr 2008 01:27:10 +0300</pubDate>
			<category>The Bat! - Configuring the E-mail Client</category>
		</item>
		<item>
			<title>Can TB move a file, and send a link to it?</title>
			<description><![CDATA[<b><a href="http://www.ritlabs.com/en/forums/forum4/topic6074/message23203/">Can TB move a file, and send a link to it?</a></b> in forum <a href="http://www.ritlabs.com/en/forums/forum4/">The Bat! - Configuring the E-mail Client</a>. <br />
			I would do this with a .vbs file which iterates through all .txt files in a given dir, parses filename to determine recipient etc., moves the file to another dir, converts new local path to a valid URL, and then creates a temporary template file. Then sends a command to theBat to send the message.<br /><br />With .vbs files it's very easy to perform file operations and string manipulation. Probably the same can be achieved with .bat/.cmd but I'm not very good with these and don't know how to deal with strings, if possible at all. <br />
			<i>12 April 2008 21:44:26, <a href="http://www.ritlabs.com/en/forums/">bigg one</a>.</i>]]></description>
			<link>http://www.ritlabs.com/en/forums/forum4/topic6074/message23203/</link>
			<guid>http://www.ritlabs.com/en/forums/forum4/topic6074/message23203/</guid>
			<pubDate>Sat, 12 Apr 2008 21:44:26 +0300</pubDate>
			<category>The Bat! - Configuring the E-mail Client</category>
		</item>
		<item>
			<title>Can TB move a file, and send a link to it?</title>
			<description><![CDATA[<b><a href="http://www.ritlabs.com/en/forums/forum4/topic6074/message23197/">Can TB move a file, and send a link to it?</a></b> in forum <a href="http://www.ritlabs.com/en/forums/forum4/">The Bat! - Configuring the E-mail Client</a>. <br />
			Thank you for your reply. You did not misunderstand, the problem was, I was not not clear enough with my message, my apology. Yes, it is on a server via <noindex><a href="http://url" target="_blank" rel="nofollow">http://url</a></noindex>.<br /><br />So, can a .cmd or .tpl be created to accomplish the link? using theBat! &nbsp; <br />
			<i>12 April 2008 01:29:02, <a href="http://www.ritlabs.com/en/forums/">Alex</a>.</i>]]></description>
			<link>http://www.ritlabs.com/en/forums/forum4/topic6074/message23197/</link>
			<guid>http://www.ritlabs.com/en/forums/forum4/topic6074/message23197/</guid>
			<pubDate>Sat, 12 Apr 2008 01:29:02 +0300</pubDate>
			<category>The Bat! - Configuring the E-mail Client</category>
		</item>
		<item>
			<title>Can TB move a file, and send a link to it?</title>
			<description><![CDATA[<b><a href="http://www.ritlabs.com/en/forums/forum4/topic6074/message23196/">Can TB move a file, and send a link to it?</a></b> in forum <a href="http://www.ritlabs.com/en/forums/forum4/">The Bat! - Configuring the E-mail Client</a>. <br />
			do you want to email someone a link to a file on your local hard disk?<br /><br />If so, this will not work, unless the recipient reads the email on the same computer. When the message is received on another computer, the link will point to a (non-existing)file on that other computer, not to the file on your computer. Unless, of course, your computer is a server with a real IP that others can access via internet, but in that case you should transform the local path to a http:// url (or to \\server\share url, if the recipient is in the same LAN and can access shared folders on your PC)<br /><br />Maybe I misunderstood. &nbsp; <br />
			<i>11 April 2008 23:44:38, <a href="http://www.ritlabs.com/en/forums/">bigg one</a>.</i>]]></description>
			<link>http://www.ritlabs.com/en/forums/forum4/topic6074/message23196/</link>
			<guid>http://www.ritlabs.com/en/forums/forum4/topic6074/message23196/</guid>
			<pubDate>Fri, 11 Apr 2008 23:44:38 +0300</pubDate>
			<category>The Bat! - Configuring the E-mail Client</category>
		</item>
		<item>
			<title>Can TB move a file, and send a link to it?</title>
			<description><![CDATA[<b><a href="http://www.ritlabs.com/en/forums/forum4/topic6074/message23195/">Can TB move a file, and send a link to it?</a></b> in forum <a href="http://www.ritlabs.com/en/forums/forum4/">The Bat! - Configuring the E-mail Client</a>. <br />
			Can TheBat! automatically move a file to a subdirectory and then mail a link to that subdirectory file?<br />Presently, the files have the users email address as part of the file name.<br />A file name example is: joe@hotmail.com~~myLifeStory.txt.<br />I am currently using to files that extract the email address from the file name, attach the file and send the attachment.<br /><br />I’m using sendFile.cmd:<br />For %%i in ("C:\BAT\TA\*.txt") do "C:\Program Files\The Bat!\thebat.exe" /MailT="C:\BAT\Sendfile.tpl";A="%%i";To="%%i";Send<br /><br />And sendfile.tpl:<br />%SetPattRegExp='C:\\BAT\\TA\\(.*?)~~(.*?)\.txt'%- <br />%RegExpBlindMatch='%To'%-<br />%ModifyOnce(To)%- <br />%SetHeader(To,%SubPatt='1')%- <br />%Subject="Hello" <br />Hi %ABToFirstName="%ToFName", <br /><br />Thank you.<br />Regards, %FromFName<br /><br />Instead of sending the file, can I get some help so that TheBat! can automatically move the file to a subdirectory (named with the email address name – already created), and send a link to the file via the email address? Thank you.<br /> <br />
			<i>11 April 2008 22:00:43, <a href="http://www.ritlabs.com/en/forums/">Alex</a>.</i>]]></description>
			<link>http://www.ritlabs.com/en/forums/forum4/topic6074/message23195/</link>
			<guid>http://www.ritlabs.com/en/forums/forum4/topic6074/message23195/</guid>
			<pubDate>Fri, 11 Apr 2008 22:00:43 +0300</pubDate>
			<category>The Bat! - Configuring the E-mail Client</category>
		</item>
	</channel>
</rss>
