Re: need help with TelnetDLX - WeOnlyDo Discussion board

Re: need help with TelnetDLX (General questions)

by woddrazen, Monday, June 22, 2009, 18:56 (5634 days ago) @ Kevin Hall

Hi Kevin,


VBscript is scripting environment so Events will now work there.

Here is VBS example that will connect to multiple servers using wodTelnetDLX and blocking mode.
[code]Dim tel1, mcol, servColl, server_hostname, server_login, server_password, first, second, serverNum
Set tel1 = WScript.CreateObject( WeOnlyDo.wodTelnetDLXCom.1 )
Set mcol = WScript.CreateObject( Scripting.Dictionary )

mcol.add 1, server1_hostname/server1_login/server1_password
mcol.add 2, server2_hostname/server2_login/server2_password
mcol.add 3, server3_hostname/server3_login/server3_password
mcol.add 4, server4_hostname/server4_login/server4_password
' and so on ...

serverNum = 0
Do
serverNum = serverNum + 1

servColl = mcol.item(serverNum)
first = InStr(1, servColl, / )
Second = InStr(first + 1, servColl, / )
server_hostname = Left(servColl, first - 1)
server_login = Mid(servColl, first + 1, Second - first - 1)
server_password = Right(servColl, Len(servColl) - second)

tel1.Timeout = 10
tel1.Protocol = 3
tel1.Blocking = 1
tel1.HostName = server_hostname
tel1.Login = server_login
tel1.Password = server_password
tel1.Connect

tel1.WaitFor ( regex:[$ #>] $ )
tel1.DataReady = 0
Wscript.Echo(tel1.Execute( ls -al + vbLf, regex:[$ #>] $ ))
tel1.Disconnect
Loop Until serverNum = mcol.Count

Wscript.Echo Done
[/code]
Hope this helps.


Regards,
Drazen


Complete thread: