Discussion:
batching telnet - hung a 'press any key to continue'
(too old to reply)
j***@cyberpine.com
2003-12-07 00:47:35 UTC
Permalink
Hello. I have this console WSH vbscript that can send an email alert
given some arguments. The script works, but does not cleanly exit
telnet. The last message I see is 'press any key to continue'. I can't
seem to send anything programatically to satify the request and so
that I can the quit Telnet.

Below is my code. Any help or information is grealy appreciated!

Set WSHShell = CreateObject("WScript.Shell")
WSHShell.Run "Telnet"
WSHShell.AppActivate "Telnet"
WScript.Sleep 1000
WSHShell.SendKeys "open mail.somesmtpserver.net 25~"
WScript.Sleep 1000
WSHShell.SendKeys "helo~"
WScript.Sleep 1000
WSHShell.SendKeys "mail from: ***@hotmail.com"
WScript.Sleep 500
WSHShell.SendKeys "rcpt to: ***@yahoo.com~"
WScript.Sleep 500
WSHShell.SendKeys "data~"
WScript.Sleep 500
WSHShell.SendKeys "Subject: item#123456~"
WScript.Sleep 500
WSHShell.SendKeys "description~"
WScript.Sleep 500
WSHShell.SendKeys "price~"
WScript.Sleep 500
WSHShell.SendKeys "line2~"
WScript.Sleep 500
WSHShell.SendKeys ".~"
WScript.Sleep 2000
WSHShell.SendKeys "~"
WScript.Sleep 500
WSHShell.SendKeys "quit~"

===
last thing i see in the console window:

Connection to host lost.
Press any key to continue...

===
it's almost as if WSH can talk at this level.
Ross Presser
2003-12-07 05:36:09 UTC
Permalink
Post by j***@cyberpine.com
Hello. I have this console WSH vbscript that can send an email alert
given some arguments.
There are several alternatives to sendkeys for scripting telnet.
Nearly all of them are better.

For my personal choice, see

http://groups.google.com/groups?selm=Xns936D6B101BB79pt101594%40129.250.170.95
j***@cyberpine.com
2003-12-07 13:10:46 UTC
Permalink
Post by Ross Presser
There are several alternatives to sendkeys for scripting telnet.
Nearly all of them are better.
Thanks Ross. I downloaded/installed Toolshack and yes sending smtp
email with it is way easy. However, I had to download and install the
this product and was hoping to come up with a solution that I could
deploy on any win2000 + desktop without having to install additional
software.

All: any chance there might be an object in plain jane windows script
host that can proxy to an SMTP server like this product does?

Set m = CreateObject("Toolsack.SMTPMail")

Thanks again!

Loading...