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 04-18-2006, 03:24 PM
zebibyte zebibyte is offline
Registered User
 
Join Date: Apr 2006
Posts: 2
Question How to send CTRL-] in VBS

I use sCRT to ssh or telnet into a Sun host, and from that host, telnet out to some telecom equipment.

Some of these telecom devices don't have the traditional logout behavior, meaning they just return to a login: prompt when you send them an exit or logout command.

The manual method to end my session is to send a CTRL-] (right bracket) to enter the control mode of my telnet, and then a "q" to exit the telnet session. This returns me to the prompt of the Sun host.

My problem is this, how do I script this logout behavior, particularly the CTRL-] sent to interrupt the telnet session?

I've tried crt.Screen.SendKeys "^{]}" and crt.Screen.SendKeys "^]"
The best I've managed is to get a ^] to appear at the login: prompt of the device I'm trying to get out of, but not stopping the telnet session.

Thanks for any suggestions,
Shawn
Reply With Quote
  #2  
Old 04-19-2006, 10:43 AM
zebibyte zebibyte is offline
Registered User
 
Join Date: Apr 2006
Posts: 2
Any suggestions?

Thanks,
Shawn
Reply With Quote
  #3  
Old 04-19-2006, 10:59 AM
tnygren's Avatar
tnygren tnygren is offline
Registered User
 
Join Date: May 2005
Posts: 1,408
Hi Zebibyte,

The first would be to send the decimal code for that key combination. The send command would look like:

crt.Screen.Send chr(29)

Alternatively, if there are several control commands that need to be sent for other options, it may help to create a function to determine the decimal value for the different control sequences.

This would look like:

Code:
crt.Screen.Send Control("]")

'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Private Function Control(character)
    ' The following formula is useful:
    '   ASCIIControlCode = chr(asc(<ASCII value of upper-case character>) - 64)
    Control = chr(asc(character) - 64)
end Function
Does this help?
__________________
Thanks,

Teresa

Teresa Nygren
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 12:25 PM.