Trouble using blat.exe or command-line mailer in a vbscript 
Author Message
 Trouble using blat.exe or command-line mailer in a vbscript

I need to mail some log files from a server on a regular basis. The
machine is a standalone windows machine.

I have used the command-line mailer blat.exe
( http://www.*-*-*.com/ ~tcharron/blat.html) to send stuff via a
batch script successfully before but I cannot get this to work in a
VBScript. I have included a snippet of code below..is there some
obvious error/reason that it will not work?

set sh=CreateObject("Wscript.shell")



some.school.edu -base64"

   sh.run sCmd1 & "",0,True
   sh.run sCmd3 & "",0,True

The blat commands as written above run just fine manually from the
command line but not as part of the vbscript.  Note I have changed the
mail server name and e-mail address. : )

Thanks,

Jeff



Wed, 27 Jul 2005 10:21:52 GMT  
 Trouble using blat.exe or command-line mailer in a vbscript
The 1st command probably isn't complete when you issue the second one.

Try using the Exec method of the Shell object instead of Run.  Exec returns
an Exec object, which has a status property that you can look at to see if
the command is complete:

 set sh=CreateObject("Wscript.shell")



some.school.edu -base64"

 Set oExec = sh.Exec ( sCmd1 )
 While oExec.Status = 0
     WScript.Sleep 10
  Wend

 Set oExec = sh.Exec ( sCmd3 )


Quote:
> I need to mail some log files from a server on a regular basis. The
> machine is a standalone windows machine.

> I have used the command-line mailer blat.exe
> (http://www.interlog.com/~tcharron/blat.html) to send stuff via a
> batch script successfully before but I cannot get this to work in a
> vbscript. I have included a snippet of code below..is there some
> obvious error/reason that it will not work?

> set sh=CreateObject("Wscript.shell")



> some.school.edu -base64"

>    sh.run sCmd1 & "",0,True
>    sh.run sCmd3 & "",0,True

> The blat commands as written above run just fine manually from the
> command line but not as part of the vbscript.  Note I have changed the
> mail server name and e-mail address. : )

> Thanks,

> Jeff



Wed, 27 Jul 2005 22:21:03 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Passing values into and out of Command Line application *and* command line prompt in vbscript

2. Need Example Of Using Blat Mail with VBScript

3. Exe ASP from command line

4. getting output of command line exe

5. Sleep command and running a command line in VBScript

6. Exe ASP from command line

7. end task Outlook.exe from command line?

8. getting output of command line exe

9. Scripting command line applications & Command Line Prompting

10. Command-Line arguments using Command()

11. Help with Win 95 screen saver command line - command line.zip [1/1]

12. Vbscript Mailer error

 

 
Powered by phpBB® Forum Software