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 05-09-2018, 09:20 PM
sakurawill sakurawill is offline
Registered User
 
Join Date: May 2018
Posts: 2
get2 will make something wrong with waitforstring

if i use get2 in vbscript,just like
Code:
	tab.Screen.Get2(row, 4, row ,17)
	tab.Screen.WaitForString "Are you Sure [y/n] ? "
	tab.Screen.Send "y" & vbcr
then the result will be like this
Code:
Are you Sure [y/n] ? 
pc01> y
pc01>
but it should be this
Code:
Are you Sure [y/n] ? y
pc01>
and if i use get instead of get2,it will works as it should be.
is that a bug or it should be fixed?
Reply With Quote
  #2  
Old 05-10-2018, 12:46 PM
berdmann berdmann is offline
VanDyke Technical Support
 
Join Date: Aug 2017
Posts: 49
Hi,

It appears that there may be some code missing here...

So, reading between the lines I would assume that you have defined a variable that is holding the result of Get2().

Get2() returns the characters on each row with a trailing CR LF, so that the rows can be split by looking for the vbcrlf sequence.

I would venture that you are using the results of the Get2() function as part of a subsequent command that you are sending with Screen.Send() (This is the component of your code that seems to be missing from the example block that you posted).

You can find additional information on SecureCRT Screen Object, specifically the Get and Get2 methods.

Because Get2 includes a trailing CR LF, these are getting sent along with the command, resulting in 2 Carriage Returns and a Line Feed getting sent. This is why you are seeing the behavior that you have described.

To fix the problem use Get() instead of Get2() when your row value is the same for the start-row and end-row parameters. Alternatively replace() to remove the trailing vbcrlf from the results of your Get2() call. For Example:
Code:
strData = tab.Screen.Get2(row, 4, row, 17)
' .
' .
' .
tab.Screen.Send "del-file " & Replace(strData, vbcrlf, "") & vbcr
tab.Screen.WaitForString "Are you Sure [y/n] ? "
tab.Screen.Send "y" & vbcr
Does this help?
__________________
Thanks,
--Brittney

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #3  
Old 05-10-2018, 01:34 PM
sakurawill sakurawill is offline
Registered User
 
Join Date: May 2018
Posts: 2
wow,it works. Thanks a lot.
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 07:39 PM.