Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using Blat in FoxPro

Status
Not open for further replies.

achen

Programmer
Jul 21, 2000
11
US
Hi,

I am trying to use Blat in FoxPro to send the user information when needed, but have no idea where to start (or say do not know how to write the code in FoxPro). I have searched some Web sites and have not found anything yet. Can anyone give me some help ? Thank you!!

Ashley
 
Pardon my ignorance, but what is Blat? Jon Hawkins
jonscott8@yahoo.com

The World Is Headed For Mutiny,
When All We Want Is Unity. - Creed
 
Whew! I'm glad I'm not the only one Blat-ignorant.

But I was able to find this description, which seems to match what achen wants to do:

"Blat is a Windows NT console utility that sends the contents of a file in an e-mail message using the SMTP protocol. Blat is useful for creating scripts where mail has to be sent automatically (CGI, backups, etc.) "

Achen, we have several threads in the VFP forum about how to send mail via VFP that you might want to look at. Also, you should check out the free utilities for sending mail and other Internet stuff in Rick Strahl's wwIPStuff class library, available at

Robert Bradley

 
I am trying to use Blat in VFP 6.0. I construct a string then use strofile() to create a bat file that I execute with 'run batfile'. I installed Blat and it runs fine from a DOS command line, but I keep getting the error 'Bad command' when I try running it from VFP. I have set the path to include the DOS path used for successful Blat execution.

Has anyone had any success running Blat from VFP, has anyone had trouble using the 'run' command from VFP?
 
Perhaps you could show us the code that generates the .BAT file, and of course the exact code that you are using to fire up this .BAT file. Also, since .BAT files do have some differences based on the OS, what OS(s) are you running under?

Rick
 
I'm currently using Win95. The code:
frbat='blat '+frfile+' -server myserver -p myprofile -f emailaddress -s "Testing Report" -t '+ mfremail
batfile=mdir+'\frbat.bat'
STRTOFILE(frbat,batfile)
run batfile
Obviously 'frfile' and 'mfremail' are previously defined.
 
Try:
RUN /N "&batfile"

Also, there are limits to the length of a BAT file line, obviously without knowing the values of "frfile" and "mfremail", I can't guess if it's too long.

Rick
 
By way of explanation:

The VFP command "run batfile" will attempt to execute a program called "batfile", which isn't what you want (there is no file called "batfile"). You want to execute the bat file whose name is contained in the memory variable "batfile". Rick's code above will do just that.
 
Thanks. I realized the mistake and it runs fine.
Thanks again
 
And as long as we are explaining things, I added the "'s around &batfile, just in case the 'mdir' variable had any embedded spaces. The /N of course is to allow your VFP program to continue, and while the help file indicates it's only required for "windows" executables, I've found cases where DOS / Command line program caused the program to "stall", so I regularly include it - it never hurts.

Rick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top