I have the following, but now I need to write the results to a file:
Set oShell = CreateObject("WScript.Shell")
oShell.Run "Telnet www.xxx.com 80"
oShell.AppActivate "Telnet"
WScript.Sleep 500
oShell.SendKeys("GET /index.html HTTP/1.1")
WScript.Sleep 500
oShell.SendKeys("{Enter}")
WScript.Sleep 500
oShell.SendKeys("{Enter}")
Thanks
The most frequent advice I have seen on this subject is to get a
different, scriptable telnet client. For more on the subject, try a
groups.google search on telnet script.
Tom Lavedas
===========
http://members.cox.net/tglbatch/wsh/
For Telnet, I can highly recommend TST10.exe
(http://www.winsite.com/bin/Info?500000000873). I've built some good
SMTP/POP troubleshooting tools with it and some Cisco router configuration
utilities. vbScript allows you to created the input data file on the fly,
and TST10 can automatically save the output (session) data to a file.
"Cosmic Cruizer" <XXjbh...@white-star.com> wrote in message
news:Xns9A7F98A22C960...@207.115.17.102...
Thanks.
"Harvey Colwell" <Harvey...@effingham.net> wrote in
news:#bZhndjn...@TK2MSFTNGP03.phx.gbl:
Have you looked at the telnet help? The client for XP, at least, has
a -f switch that provides a client side log. Might that serve your
need?
Also, the AppActivate function can close the loop around the start of
the telnet session to be a bit more robust ...
with CreateObject("WScript.Shell")
.Run "Telnet -f log.txt -t ansi www.xxx.com 80"
do until .AppActivate("Telnet") : WScript.Sleep 50 : loop
.SendKeys "GET /index.html HTTP/1.1"
WScript.Sleep 500
.SendKeys "{Enter 2}"
end with
> On Apr 14, 9:56 pm, Cosmic Cruizer <XXjbhun...@white-star.com> wrote:
>> The project is to first try to do it with only vbscript. If that's
>> not possible, which I'm seeing it probably isn't without needing to
>> to start swap out telnet or adding dll's, etc, then it will be just
>> as easy to create a wrapper for a perl script and use it instead.
>>
>> Thanks.
>
> Have you looked at the telnet help? The client for XP, at least, has
> a -f switch that provides a client side log. Might that serve your
> need?
>
> Also, the AppActivate function can close the loop around the start of
> the telnet session to be a bit more robust ...
>
> with CreateObject("WScript.Shell")
> .Run "Telnet -f log.txt -t ansi www.xxx.com 80"
> do until .AppActivate("Telnet") : WScript.Sleep 50 : loop
> .SendKeys "GET /index.html HTTP/1.1"
> WScript.Sleep 500
> .SendKeys "{Enter 2}"
> end with
>
> Tom Lavedas
>===========
> http://members.cox.net/tglbatch/wsh/
>
Tom,
The -f flag was the magic ticket. I didn't even know it existed.
Thank you very much!
>The project is to first try to do it with only vbscript. If that's not
>possible, which I'm seeing it probably isn't without needing to to start
>swap out telnet or adding dll's, etc, then it will be just as easy to
>create a wrapper for a perl script and use it instead.
I use Netcat (NC). It's only a few kb and doesn't need to be installed.
I create the command file and run it.
' *******************************************************
' PopMail
' Elenca i messaggi di posta elettronica presenti
' su un server pop3 e permette di cancellarli prima
' di cancellarli.
' Lists e.mail messages in a window and allows you
' to choose which ones to delete.
' Cenati Giovanni http://digilander.libero.it/Cenati
' Codice liberamente utilizzabile citando il sito.
' Comandi POP3 Commands http://www.freesoft.org/CIE/RFC/1725/1.htm
' *******************************************************
Title="PopMail - Cenati"
set wshShell = CreateObject("WScript.Shell")
' Crea l'oggetto FileSystemObject
Set fso = WScript.CreateObject("Scripting.FileSystemObject")
Const ForWriting = 2
User= inputbox("Nome Casella di posta",title,"reve...@mymail.com")
Password=InputBox("Password",Title,"mypassword")
Server=InputBox("Nome del server pop3",title,"pop.server.com")
if User="" or Password="" or Server="" then wscript.quit
'Creo il file "command.txt" con l'autenticazione e la richiesta
'del numero di messaggi e-mail e la lunghezza in bytes
fso.CreateTextFile "command.txt",true
Set txtStream=fso.OpenTextFile("command.txt",ForWriting)
TxtStream.WriteLine "user " & user
TxtStream.WriteLine "pass " & password
TxtStream.WriteLine "stat" 'Chiede numero messaggi e occupazione totale
TxtStream.WriteLine "quit"
txtStream.Close
'Invia il login e chiede l'elenco dei messaggi
wshShell.run "%comspec% /C nc.exe " & server & " 110 <command.txt >output.txt",7,true
--
Giovanni Cenati (Bergamo, Italy)
Write to "Reventlov" at katamail com
http://digilander.libero.it/Cenati (Esempi e programmi in VbScript)
--