Wed, 11 Aug 2004 18:52:57 +0200 (12:52 PM EDT here) Alexander S. Kunz wrote:

> is there a macro (or some other solution) to test the existence of a
> file on disk? Something like "if exists 'c:\file\foo.txt" add it to
> the message, if its not there, don't do anything.

I haven't tested this, but I think it will do what you want to do.

1. Add the MyMacros plug in to TheBat! After you've done that, you can
   use %Run(command line) to run a command line from a Quick Template.

2. Create a directory called (for example) c:\forthis .

3. Create an empty text file in the forthis directory. Call the file
   empty.txt . Give empty.txt the read-only attribute.

4. Create a batch file, called thefile.bat in the forthis directory.

  Rem begin thefile.bat

  cd c:\forthis

  copy c:\forthis\empty.txt c:\forthis\adhoc.txt

  if exist <path>\yourfile.txt copy <path>\yourfile.txt c:\forthis\adhoc.txt

  Rem end thefile.bat

5. Write a Quick Template called GetFile

  %Rem="Start GetFile"%-
  %-
  %Run(c:\forthis\thefile.bat)%-
  %Include(c:\forthis\adhoc.txt)%-
  %-
  %Rem="End GetFile"%-

6. Use %Qinclude(GetFile) in a template

   or

   Type GetFile[Ctrl]+[Space] in a message

   If yourfile exists, the contents of adhoc.txt (which is identical
   to the contents of yourfile) will be included in the message.

   If yourfile doesn't exist, the contents of adhoc.txt (which is identical
   to the non-contents of empty.txt) will be included in the message.



Using: The Bat! v2.12.00, BayesIt! 0.5.5, MyMacros 1.11
       Windows 2000 v5.0 - Build 2195 - Service Pack 4



-- 

Daniel A. Grunberg       Kensington, Maryland, USA
homepage: www.nyx.net/~dgrunber/


________________________________________________
Current version is 2.12.00 | 'Using TBUDL' information:
http://www.silverstones.com/thebat/TBUDLInfo.html

Reply via email to