Welcome to the VanDyke Software Forums

Join the discussion today!


Go Back   VanDyke Software Forums > Scripting

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 01-26-2018, 11:16 AM
bstedh bstedh is offline
Registered User
 
Join Date: Jan 2018
Posts: 41
Unhappy ReadString missing text

Ok, I am sure I am missing something obvious on this one.

I am doing a simple cisco show int desc and capturing the output to parse later. Only, half the time it doesn't capture the output and just gives me the prompt text at the end, but half the time it works fine.

I have tried several tweaks from switching synchronous to changing where and when the vbCr is sent with no change. It still misses the output about 50% of the time or more.


Code:
objTab.screen.Send "sh int desc"
	Status = f31Output
The Function
Code:
Function f31Output 'Read CSR command output into variable
	objTab.screen.Synchronous = True
	objTab.screen.IgnoreEscape = True
	objTab.screen.send vbCr
	Wait = objTab.screen.WaitForStrings (vbCrLf)
	Output = objTab.screen.ReadString ("#")
	
	f31Output = Output
	crt.Clipboard.Format = "CF_TEXT"
	crt.Clipboard.Text = Output
End Function
__________________
Version 6.7.3 (build 292)
Reply With Quote
  #2  
Old 01-26-2018, 11:23 AM
bstedh bstedh is offline
Registered User
 
Join Date: Jan 2018
Posts: 41
Nevermind, i'm an idiot. I have my script on a quick button and forgot to change it to the most recent version of my script so every time i made a change I was still running the older version...

No wonder I couldn't get any of my changes to do anything different.
__________________
Version 6.7.3 (build 292)
Reply With Quote
  #3  
Old 01-26-2018, 11:29 AM
berdmann berdmann is offline
VanDyke Technical Support
 
Join Date: Aug 2017
Posts: 352
Hi bstedh,

I am happy to hear that you were able to get to the bottom of it!

Please let us know if you have any additional questions or concerns moving forward!
__________________
Thanks,
--Brittney

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #4  
Old 01-26-2018, 11:47 AM
bstedh bstedh is offline
Registered User
 
Join Date: Jan 2018
Posts: 41
Well that didn't help. problem still persists. I quit using the function and just tried reading the output directly inline and am still having the same issue with it not capturing the output more than 50% of the time. All I get is the prompt text right before the #.

Code:
	objTab.screen.Send vbCr
	objTab.screen.WaitForString "#"
	objTab.screen.Send "sh int desc" & vbCr
'	Wait = objTab.screen.WaitForStrings (vbCr)
	Status = objTab.screen.ReadString ("#")
__________________
Version 6.7.3 (build 292)
Reply With Quote
  #5  
Old 01-26-2018, 11:54 AM
bstedh bstedh is offline
Registered User
 
Join Date: Jan 2018
Posts: 41
Not sure what is up, I applied crowbar logic and doubled up and now it is working.

Code:
	objTab.screen.Send vbCr
	objTab.screen.WaitForString "#"
	objTab.screen.Send "sh int desc" & vbCr
	Status = objTab.screen.ReadString ("#")
	objTab.screen.Send "sh int desc" & vbCr
	Status = objTab.screen.ReadString ("#")
Not very elegant but it seems to be working every time now...
__________________
Version 6.7.3 (build 292)
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -6. The time now is 08:38 PM.