Xshell Forum

Xshell Script does not Auto Login device

Last post: Wednesday, October 9, 2013 6:04 PM by Support, 7 reply

 
Tuesday, September 24, 2013 1:30 AM - le tian

Xshell Script does not Auto Login device

 
When I use the example script, pop up a dialog box to enter a user name, you can not automatically log device, the script is as follows:

Sub Main
xsh.Session.Open "ssh://10.0.34.4"
xsh.Screen.Synchronous = true
xsh.Screen.WaitForString "login: "
xsh.Screen.Send "admin"
xsh.Screen.Send VbCr
xsh.Session.Sleep 100
xsh.Screen.WaitForString "Password: "
xsh.Screen.Send "passwd"
xsh.Screen.Send VbCr
xsh.Session.Sleep 100
End Sub

Please help, thank you!

Program Ver. : Xshell 4
Wednesday, September 25, 2013 2:20 AM - Support

Re: Xshell Script does not Auto Login device

 
It looks like there is an error in our example script file. SSH protocol always opens up a dialog box due to different types of authentication methods that SSH offers.

Try using this script instead:

Sub Main
xsh.Session.Open "ssh://username:password@host"
xsh.Screen.Synchronous = true
End Sub

Please remember this will have your password in the script file.

---
Technical Support
Thursday, September 26, 2013 10:36 PM - le tian

Re: Xshell Script does not Auto Login device

 
thank you!Automatic login to solve the problem, but I encountered a new problem, I want to use xsh.Screen.Get () to get the first character of current line, do not know how to write?
Saturday, September 28, 2013 6:58 PM - le tian

Re: Xshell Script does not Auto Login device

 
I know how to write:
sub main
dim str1
str1 = xsh.screen.get(xsh.screen.currentrow,1,xsh.screen.currentrow,1)
xsh.dialog.msgbox(str1)
end sub
Saturday, September 28, 2013 7:11 PM - le tian

Re: Xshell Script does not Auto Login device

 
I encountered a new problem, when I run the following script:

sub main
xsh.screen.waitForStrings ("this",1000)
end sub

Always prompts me:“调用过程(sub)时不能使用括号。”

I do not know how to solve, please help me. Thank you!
Monday, September 30, 2013 8:47 AM - Support

Re: Xshell Script does not Auto Login device

 
Have you tried using it like this?

xsh.Screen.WaitForString "this"
xsh.Session.Sleep 100

Can you tell us what you are trying to achieve with this script?

---
Technical Support
Monday, October 7, 2013 6:16 PM - le tian

Re: Xshell Script does not Auto Login device

 
I want to use this script to grab the device configuration, but the configuration of the device can only split-screen display, so I want to appear when I'm waiting for the string to the next step, when the string does not appear, wait after a few seconds and then moves down.


my script :
sub main
str1 = "dis cu"
xsh.Screen.Send str1 & vbcr
xsh.Screen.waitForStrings ("---- More ----",100)
xsh.Session.Sleep 1000
xsh.Screen.Send " "
xsh.Screen.waitForString "return"
xsh.Session.Sleep 1000
xsh.Session.StopLog
xsh.Session.Close
end sub
Wednesday, October 9, 2013 6:04 PM - Support

Re: Xshell Script does not Auto Login device

 
Can you send us the log file to support@netsarang.com? We will try to duplicate the issue in our lab and make a running script.

---
Technical Support