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 07-06-2016, 10:03 AM
ShawnVW ShawnVW is offline
Registered User
 
Join Date: May 2016
Posts: 15
Am I capturing hidden characters?

I'm using the Get command to capture a single character on screen, usually the letter "N":

Code:
x = crt.screen.get(11,68,11,68)
crt.Session.SetStatusText(">" & x  & "<" )

But when this should display ">N<", it shows "> (about 20 blank spaces) <"

Are there some hidden characters or something that could be causing this?

Last edited by ShawnVW; 07-06-2016 at 10:19 AM.
Reply With Quote
  #2  
Old 07-06-2016, 11:05 AM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,001
Hi ShawnVW,

In my tests, it worked as expected, but I controlled the output (see attached).

There could be hidden characters in the output you receive, but I need additional information about that output. It's strange that you get 20 or so characters. It sounds like there could be line endings or tabs being converted to spaces that is throwing things off.

Are these two lines the entirety of your script?

What is the output you receive prior to running this code?

If you paste that output into some application with the ability to show hidden/non-printing characters, does that shed any light on what the 68th character actually is?
Attached Images
File Type: png ForumThread12398.png (50.1 KB, 329 views)
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #3  
Old 07-06-2016, 11:13 AM
ShawnVW ShawnVW is offline
Registered User
 
Join Date: May 2016
Posts: 15
Quote:
Originally Posted by bgagnon View Post
Are these two lines the entirety of your script?
Not even close!


Quote:
What is the output you receive prior to running this code?
It's a form. The character I want to capture is in one of the fields. Actually, I tried capturing the field label too, but I just got longer string of blank spaces.

Quote:
If you paste that output into some application with the ability to show hidden/non-printing characters, does that shed any light on what the 68th character actually is?
What sort of application can do that?

Thanks!
Reply With Quote
  #4  
Old 07-06-2016, 12:21 PM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,001
Hi ShawnVW,

With a form it may be difficult to accomplish the objective. Get() may not be the best method to use.

I believe you can show formatting marks in several of the Microsoft Office products. You might just search on "show invisibles" or a similar term in the Help file.
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #5  
Old 07-06-2016, 12:33 PM
ShawnVW ShawnVW is offline
Registered User
 
Join Date: May 2016
Posts: 15
I found something. The field label reads "22)<7 spaces>ALLOW B/O".

I used this:

Code:
	strResult = crt.Screen.ReadString("ALLOW B/O:")
	msgbox(right(strResult,20))
The result I expected was:

"<several spaces>22)<7 spaces>ALLOW B/O:"

What I got was:
"N:<left arrow>[11;47H22)<several spaces>"

Isn't there some method to capture just the "normal" characters onscreen?

If Get isn't the best way to see what's at a particular point on the screen, what would be better?
Reply With Quote
  #6  
Old 07-06-2016, 12:47 PM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,001
Hi ShawnVW,

Yes, I believe it's the IgnoreEscape property available to the Screen Object that you seek. (See Scripting / Script Objects Reference / Screen Object in SecureCRT's Help file.)

That should take care of the escape sequence [11;47H22], but I am not sure what you mean by the <left arrow> reference. What is the actual output?


Quote:
If Get isn't the best way to see what's at a particular point on the screen, what would be better?
Right now I only have limited information. I would need "big picture" info to provide any further advice.
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #7  
Old 07-06-2016, 01:07 PM
ShawnVW ShawnVW is offline
Registered User
 
Join Date: May 2016
Posts: 15
By <left arrow> I meant single character that looks like a left-pointing arrow.

I tried IgnoreEscape. I got a different string:
)800 PHN:22) <spaces>

When you say "What is the actual output", I'm not sure what to say other than its a screen full of field labels and the content of those fields. (How can I attach a screenshot?)
Reply With Quote
  #8  
Old 07-06-2016, 01:49 PM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,001
Hi ShawnVW,

There should be a paperclip icon in the formatting toolbar provided when you post a reply. That will allow you to attach files.

I suspect the best way to see what the output is will be to get a raw log.

To create a raw log:
  • Before connecting with the session, select Raw Log Session from SecureCRT's File menu.
  • In the Select Log File dialog, choose a folder and filename in which you would like the log text to be stored and press the Save button. At this point, if you open the File menu, you will notice that the Raw Log Session menu item now has a checkmark next to it; this indicates that raw logging is activated.
  • Now connect to the remote machine and perform the actions that cause the behavior.
  • Disconnect the session and select Raw Log Session from the File menu to turn off the raw logging feature.
Since a raw log can contain sensitive information, please send it as an attachment via email to support@vandyke.com. Please reference "Attn Brenda - Forum Thread #12398" in the subject line.
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #9  
Old 07-06-2016, 03:44 PM
ShawnVW ShawnVW is offline
Registered User
 
Join Date: May 2016
Posts: 15
I'm not sure I'm allowed to send you a filled-out form (or log), but here's a blank one attached.

The Raw Log shows lots of those symbols and codes I described, even with IgnoreEscape turned on. After experimenting some more with ReadString, I don't think the characters' "position" is really where they "are".

Thanks, though.
Attached Files
File Type: docx screenshot.docx (254.7 KB, 294 views)
Reply With Quote
  #10  
Old 07-07-2016, 08:52 AM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,001
Hi ShawnVW,

Without the raw log, I can only guess, but if the ALLOW B/O is the data you are trying to get, then you might consider code similar to this:

Code:
crt.Screen.WaitForString("ALLOW B/O:")
crt.Screen.ReadString("Y", "N")
If crt.Screen.MatchIndex = 1 Then
    MsgBox("Allow B/O = Yes!")
ElseIf crt.Screen.MatchIndex = 2 Then
    MsgBox("Allow B/O = No")
End If
That assumes that the Y or the N actually comes from the remote in sequence row by row. It's possible that the remote system paints all the fields first, and then paints the values in the fields (you already know there's at least an escape sequence surrounding the "Y" and the "N" to make it bold, so crt.Screen.IgnoreEscape will need to remain true for the duration of whatever script you are running).
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #11  
Old 07-07-2016, 09:08 AM
ShawnVW ShawnVW is offline
Registered User
 
Join Date: May 2016
Posts: 15
I think you're right about the field values being painted after the field labels. Plus, when I capture the text with ReadString, it shows nothing between one label and the next, as if the field itself isn't there.

I'll just have to proceed without actually "knowing" what's in that field. Thanks again!
Reply With Quote
Reply

Tags
screen->get , vbscript


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 01:01 PM.