#1
|
|||
|
|||
save in the text file
Hello
I was able to use ReadString() to capture the output of "show running-config" command and save it into the file using objFile.WriteLine. However the very first line in the text file included the command. Is there way not to include the command in the text file? Code:
Dim objTab, szCommand Set objTab = crt.GetScriptTab szCommand = "show cur" objTab.Screen.Send szCommand & chr(13) objTab.Screen.WaitForString vbCr Dim strResult, objFile strResult = objTab.Screen.ReadString ("return",3) Set objFile = g_fso.OpenTextFile("c:\temp\config_sample.txt", ForWriting, True) objFile.WriteLine strResult objFile.Close Thank you Samky2005 Last edited by cboyack; 10-20-2020 at 11:50 AM. Reason: Please use [CODE] and [/CODE] tags to denote code strings |
#2
|
||||
|
||||
Quote:
Regardless, to answer your question, you're doing this: Code:
szCommand = "show cur" objTab.Screen.Send szCommand & chr(13) objTab.Screen.WaitForString vbCr Code:
strCommand = "show cur" objTab.Screen.Send strCommand & vbcr ' Instead of just waiting for a CR, let's wait for the ' entire command to appear: objTab.Screen.WaitForString strCommand & vbcr
__________________
Jake Devenport VanDyke Software Technical Support YouTube Channel: https://www.youtube.com/vandykesoftware Email: support@vandyke.com Web: https://www.vandyke.com/support |
#3
|
|||
|
|||
No. I couldn't find the post. Thank you for sharing.
And thank you very much for quick fix on my script. That met my expectation. Thanks Samky2005 |
#4
|
|||
|
|||
SSH vs Serial
I happened to find the script didn't work for Serial connection. It works for SSH session. I tried to find the solution but not yet solved.
Appreciated any insight. Thanks samky2005 |
#5
|
||||
|
||||
Quote:
Can you share more details about how the script failed for you? For example:
.
__________________
Jake Devenport VanDyke Software Technical Support YouTube Channel: https://www.youtube.com/vandykesoftware Email: support@vandyke.com Web: https://www.vandyke.com/support |
#6
|
|||
|
|||
Hello Jake
Sorry for the ambiguity. The issue was when the serial(COM1) protocol was used, the created file was empty. The device wasn't changed. The script ended without any error and also didn't hung. I attached the zip file FYI. I inserted 'MsgBox strResult' as for the troubleshooting. It returned empty with Serial but returned the result as I expect. I'm using 8.0.0. Thansk Samky2005 |
#7
|
||||
|
||||
Samky2005,
For further troubleshooting efforts, we'll need to have more information provided. Because these next steps will involve sensitive information that should not be posted to the public forums, please send email to support@vandyke.com:
__________________
Jake Devenport VanDyke Software Technical Support YouTube Channel: https://www.youtube.com/vandykesoftware Email: support@vandyke.com Web: https://www.vandyke.com/support |
![]() |
Tags |
readstring , save to a file |
Thread Tools | |
Display Modes | Rate This Thread |
|
|