Automating a Script - WeOnlyDo Discussion board

Automating a Script (General questions)

by Eric Grau, Monday, November 26, 2007, 18:36 (6206 days ago)

This issue is found using Visual Basic 2005 Express.

Problem: Trying to auto login to a SSH server, automate the prompts to put the user at a certain spot without having the user select the ANSI menus directly. I program needs to wait after each menu selection for some text on the next menu screen before sending the next menu command.

Solution Attempt: I have added the code that i use and the code logs in and runs the first menu option and then exits no matter what I do to continue.

[code]
Telnet1 = New WODTELNETDLXCOMLIB.wodTelnetDLXCom

'GetLoginInfo()
Telnet1.Hostname = DEV1
Telnet1.Login = p5104
Telnet1.Password = p5104
Telnet1.Protocol = WODTELNETDLXCOMLIB.ProtocolsEnum.SSHAuto
Telnet1.TerminalType = tty
Telnet1.StripANSI = True


AddToList( Connecting... & vbCrLf)
Telnet1.Blocking = True
Telnet1.DebugFile = c:debug.txt
Telnet1.Connect()
On Error Resume Next
' if all succeeded

Telnet1.WaitFor( Select , 30)
Telnet1.DataReady = 0
Telnet1.Execute( e & vbCrLf, Select: , 30)
Telnet1.DataReady = 0
Telnet1.Execute( 51 & vbCrLf, Location , 30)
Telnet1.DataReady = 0
Telnet1.Execute( & vbCrLf, F4 , 30)
Telnet1.DataReady = 0
Telnet1.Execute( s5100 & vbCrLf, Password , 30)
Telnet1.DataReady = 0
Telnet1.Execute( s5100 & vbCrLf, Site , 30)
Telnet1.DataReady = 0
Telnet1.Execute( s5100 & vbCrLf, Select , 30)
Telnet1.DataReady = 0
Telnet1.Execute( 3 & vbCrLf, Select , 30)
Telnet1.DataReady = 0
Telnet1.Execute( 3 & vbCrLf, Select , 30)
Telnet1.DataReady = 0
Telnet1.Execute( bkn & vbCrLf, Employee , 30)
Telnet1.DataReady = 0
Telnet1.Send( wrkrb & vbCrLf)

AddToList( Completed Login Process... & vbCrLf)

[/code]

Code fails after 1st execute.

Error in VB is:
A first chance exception of type 'System.Runtime.InteropServices.COMException' occurred in Project1.exe


Any ideas would be appreciated. I would like to create a front end to a server app that can be scripted and am out of ideas. I check through the forums but no luck.

Regards,
Eric

Re: Automating a Script

by wodDamir, Monday, November 26, 2007, 18:49 (6206 days ago) @ Eric Grau

Hi Eric,

Is there any chance I could duplicate this? Could you provide us with access to that server?

If yes, you can send any sensitive information to techsupport@weonlydo.com

Where does this occur at? The machine you installed our component using the installer?

Regards,
Damba

Re: Automating a Script

by Eric Grau, Monday, November 26, 2007, 18:57 (6206 days ago) @ wodDamir

Hi Eric,

Is there any chance I could duplicate this? Could you provide us with access to that server?

If yes, you can send any sensitive information to techsupport@weonlydo.com

Where does this occur at? The machine you installed our component using the installer?

Regards,
Damba


This occurs on the computer installed with your component using the installer.

Maybe a simpler question would be if I used the correct approach for the script to wait for Screen prompts. All I am assuming is that multiple Execute statements would do the trick with one WaitFor to start things off.

Regards,
Eric

Re: Automating a Script

by wodDamir, Monday, November 26, 2007, 19:22 (6206 days ago) @ Eric Grau

Eric,

It should work. You can try an alternative, with WaitFor and Send Methods instead of Execute.

However, the error exception doesn't tell us much. That's why I'd like to try to duplicate and see what could be the cause of this. Is that possible?

Regards,
Damba

Re: Automating a Script

by Eric Grau, Monday, November 26, 2007, 19:34 (6206 days ago) @ wodDamir

Unfortunately I am blocked here with our firewall and can not give you access.

I will try this on a new computer to see if I get the same error. This should eliminate any issues that I might have locally. Part of the testing will include the Send and Waitfor code.

I will update this log with my findings.

Regards,
Eric