Script ErroriĀ¼?iĀ¼? [4]
Script ErrorĆÆĀ¼ĀĆÆĀ¼Ā
Saturday, September 28, 2013 7:13 PM - le tian
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!
Program Ver. : Xshell 4
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!
Program Ver. : Xshell 4
Re: Script ErrorĆÆĀ¼ĀĆÆĀ¼Ā
Monday, September 30, 2013 9:00 AM - Support
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
xsh.Screen.WaitForString "this"
xsh.Session.Sleep 100
Can you tell us what you are trying to achieve with this script?
---
Technical Support
Re: Script ErrorĆÆĀ¼ĀĆÆĀ¼Ā
Wednesday, October 2, 2013 6:27 PM - le tian
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 scriot :
Sub Main
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Dim fso,file1,line,str1,params
Set fso = CreateObject("Scripting.FileSystemObject")
Set file1 = fso.OpenTextFile("D:\test\list1.txt",Forreading, False)
xsh.Screen.Synchronous = True
DO While file1.AtEndOfStream <> True
line = file1.ReadLine
params = Split (line)
xsh.Session.LogFilePath = "d:\test\log\" & params(0) & ".txt"
xsh.Session.StartLog
xsh.Session.Sleep 100
Dim host
host = params(1)
Dim user
user = params(2)
Dim password
password = params(3)
xsh.Screen.Send vbcr & vbcr & vbcr
xsh.Screen.Synchronous = True
xsh.Session.Open "SSH://" & user & ":" & password & "@" & host
xsh.Screen.Synchronous = True
xsh.Screen.Send vbcr & vbcr & vbcr
xsh.Session.Sleep 100
Dim str8
str8 = xsh.Screen.Get(xsh.Screen.CurrentRow,1,xsh.Screen.CurrentRow,1)
xsh.Dialog.Msgbox(str8)
If str8 = "<" Then
xsh.Screen.Send "super" & vbcr
xsh.Screen.waitForString "Password:"
xsh.Screen.Send params(4) & vbcr & vbcr & vbcr & vbcr
xsh.Screen.Synchronous = True
xsh.Screen.waitForString ">"
xsh.Session.Sleep 1000
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.StopLog
xsh.Session.Close
Else
xsh.Screen.Send "enable" & vbcr
xsh.Screen.waitForString "Password: "
xsh.Screen.Send params(4) & vbcr & vbcr & vbcr & vbcr
xsh.Screen.Synchronous = True
xsh.Screen.waitForString "#"
xsh.Session.Sleep 1000
str01 = "show run"
xsh.Screen.Send str01 & vbcr
xsh.Screen.waitForStrings (" --More-- ",1000)
xsh.Session.Sleep 1000
xsh.Screen.Send " " & VbCr
xsh.Screen.waitForString "#"
xsh.Session.StopLog
xsh.Session.Close
xsh.Session.Sleep 10
End If
loop
xsh.Screen.Synchronous = False
xsh.Dialog.Msgbox("ĆØāÅ”Ć¦ÅĀ¬ĆØĀæĀĆØĀ”ÅĆ„Ā®ÅƦĀÆā¢!")
End Sub
my scriot :
Sub Main
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Dim fso,file1,line,str1,params
Set fso = CreateObject("Scripting.FileSystemObject")
Set file1 = fso.OpenTextFile("D:\test\list1.txt",Forreading, False)
xsh.Screen.Synchronous = True
DO While file1.AtEndOfStream <> True
line = file1.ReadLine
params = Split (line)
xsh.Session.LogFilePath = "d:\test\log\" & params(0) & ".txt"
xsh.Session.StartLog
xsh.Session.Sleep 100
Dim host
host = params(1)
Dim user
user = params(2)
Dim password
password = params(3)
xsh.Screen.Send vbcr & vbcr & vbcr
xsh.Screen.Synchronous = True
xsh.Session.Open "SSH://" & user & ":" & password & "@" & host
xsh.Screen.Synchronous = True
xsh.Screen.Send vbcr & vbcr & vbcr
xsh.Session.Sleep 100
Dim str8
str8 = xsh.Screen.Get(xsh.Screen.CurrentRow,1,xsh.Screen.CurrentRow,1)
xsh.Dialog.Msgbox(str8)
If str8 = "<" Then
xsh.Screen.Send "super" & vbcr
xsh.Screen.waitForString "Password:"
xsh.Screen.Send params(4) & vbcr & vbcr & vbcr & vbcr
xsh.Screen.Synchronous = True
xsh.Screen.waitForString ">"
xsh.Session.Sleep 1000
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.StopLog
xsh.Session.Close
Else
xsh.Screen.Send "enable" & vbcr
xsh.Screen.waitForString "Password: "
xsh.Screen.Send params(4) & vbcr & vbcr & vbcr & vbcr
xsh.Screen.Synchronous = True
xsh.Screen.waitForString "#"
xsh.Session.Sleep 1000
str01 = "show run"
xsh.Screen.Send str01 & vbcr
xsh.Screen.waitForStrings (" --More-- ",1000)
xsh.Session.Sleep 1000
xsh.Screen.Send " " & VbCr
xsh.Screen.waitForString "#"
xsh.Session.StopLog
xsh.Session.Close
xsh.Session.Sleep 10
End If
loop
xsh.Screen.Synchronous = False
xsh.Dialog.Msgbox("ĆØāÅ”Ć¦ÅĀ¬ĆØĀæĀĆØĀ”ÅĆ„Ā®ÅƦĀÆā¢!")
End Sub
Re: Script ErrorĆÆĀ¼ĀĆÆĀ¼Ā
Wednesday, August 19, 2015 9:33 AM - test
this will not work! ----> xsh.Screen.waitForStrings (" --More-- ",1000)
Re: Script ErrorĆÆĀ¼ĀĆÆĀ¼Ā
Wednesday, August 26, 2015 8:20 AM - Support
A fix for waitForStrings function will be included in the next release. It will fix the timeout bug.
---
Technical Support
---
Technical Support
Previous views: 460