cpatte7372
asked on
VBS Carriage Return Convert
Hello Experts,
The following is a part of script that performs a carriage when executed on a router:
& chr(13)
Can someone please tell me if its possible to convert that into an equivalent command like
|
Someone came up with the following:
aryCmds = Split(szCommand, "|").
It does work when directly connected to the device but now through a terminal server.
Cheers
Carlton
The following is a part of script that performs a carriage when executed on a router:
& chr(13)
Can someone please tell me if its possible to convert that into an equivalent command like
|
Someone came up with the following:
aryCmds = Split(szCommand, "|").
It does work when directly connected to the device but now through a terminal server.
Cheers
Carlton
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Update,
The carriage return is either & vbcrlf or just & vbcr.
Maybe I need to have that somehow represented in the script???
The carriage return is either & vbcrlf or just & vbcr.
Maybe I need to have that somehow represented in the script???
ASKER
leew,
Thanks for responding. I've looked at the example, however, how would I replace
"|" with vbCr?
Cheers
Thanks for responding. I've looked at the example, however, how would I replace
"|" with vbCr?
Cheers
ASKER
The actual full script is as follows:
# $language = "VBScript"
# $interface = "1.0"
' SendToAll.vbs
Sub Main()
if Not crt.Session.Connected then
szSession = crt.Dialog.Prompt("Enter session:", "", "", False)
if szSession = "" then exit sub
crt.Session.ConnectInTab(" /S " & szSession)
crt.Session.ConnectInTab(" /S " & szSession)
crt.Session.ConnectInTab(" /S " & szSession)
end if
' Find out what should be sent to all tabs
szCommand = crt.Dialog.Prompt("Enter command to be sent to all tabs:", _
"Send To All Connected Tabs", "ls", False)
if szCommand = "" then exit sub
If crt.Dialog.MessageBox(_
"Are you sure you want to send the following command to " & _
"__ALL__ tabs?" & vbcrlf & vbcrlf & szCommand, _
"Send Command To All Tabs - Confirm", _
vbyesno) <> vbyes then exit sub
' Connect to each tab in order from left to right, issue a command, and
' then disconnect...
aryCmds = Split(szCommand, "|")
For nIndex = 1 to crt.GetTabCount
Set objCurrentTab = crt.GetTab(nIndex)
objCurrentTab.Activate
If objCurrentTab.Session.Conn ected = True then
For Each strOneCmd In aryCmds
crt.Sleep 500
objCurrentTab.Screen.Send strOneCmd & vbcr
crt.Sleep 1000
Next
End if
Next
MsgBox "The following command was sent to all connected tabs:" & vbcrlf & _
vbcrlf & szCommand
End Sub
And I need "|" changed to vbCR, I think....
# $language = "VBScript"
# $interface = "1.0"
' SendToAll.vbs
Sub Main()
if Not crt.Session.Connected then
szSession = crt.Dialog.Prompt("Enter session:", "", "", False)
if szSession = "" then exit sub
crt.Session.ConnectInTab("
crt.Session.ConnectInTab("
crt.Session.ConnectInTab("
end if
' Find out what should be sent to all tabs
szCommand = crt.Dialog.Prompt("Enter command to be sent to all tabs:", _
"Send To All Connected Tabs", "ls", False)
if szCommand = "" then exit sub
If crt.Dialog.MessageBox(_
"Are you sure you want to send the following command to " & _
"__ALL__ tabs?" & vbcrlf & vbcrlf & szCommand, _
"Send Command To All Tabs - Confirm", _
vbyesno) <> vbyes then exit sub
' Connect to each tab in order from left to right, issue a command, and
' then disconnect...
aryCmds = Split(szCommand, "|")
For nIndex = 1 to crt.GetTabCount
Set objCurrentTab = crt.GetTab(nIndex)
objCurrentTab.Activate
If objCurrentTab.Session.Conn
For Each strOneCmd In aryCmds
crt.Sleep 500
objCurrentTab.Screen.Send strOneCmd & vbcr
crt.Sleep 1000
Next
End if
Next
MsgBox "The following command was sent to all connected tabs:" & vbcrlf & _
vbcrlf & szCommand
End Sub
And I need "|" changed to vbCR, I think....
ASKER
Cheers
ASKER
I found out that the carriage return script is keymap used in SecureCRT for VBS is "\r". Maybe that needs to be converted instead of "& chr(13)"? I need help with that.
Cheers
Carlton