Welcome to the VanDyke Software Forums

Join the discussion today!

Go Back   VanDyke Software Forums > Scripting


Thread Tools Rate Thread Display Modes
Old 10-14-2008, 01:07 PM
dogchainx dogchainx is offline
Registered User
Join Date: Oct 2008
Posts: 1
Sending Function keys...again. F2 and SCOANSI

I'm having trouble finding the correct way of sending the F2 key to an emulated SCO/ANSI terminal using SecureCRT and a VBscript.

Any help? Here is my script. Everything works except the last part in sending the F2 key.

# $language = "VBScript"
# $interface = "1.0"

' Connect to a telnet server and automate the initial login sequence.
' Note that synchronous mode is enabled to prevent server output from
' potentially being missed.

Sub Main

crt.Screen.Synchronous = True

crt.Screen.WaitForString "login:"

crt.Screen.Send "login" & vbCr

crt.Screen.WaitForString "Password:"

crt.Screen.Send "password" & vbCr

crt.Screen.Send vbCr

crt.Screen.Send "a1" & vbCr

crt.Screen.Send vbCr

crt.Screen.Send "b1" & vbCr

crt.Screen.Send "3"

crt.Screen.Send "2"

crt.Screen.Send "3"

crt.Screen.Send "L"

CRT.Screen.SendSpecial "VT_CURSOR_DOWN"
CRT.Screen.SendSpecial "VT_CURSOR_DOWN"
crt.screen.send "MFG" & vbCr
crt.screen.send "SSS"
--> crt.screen.sendSpecial "VT_F7" <--
crt.Screen.Synchronous = False

End Sub
Reply With Quote
Old 10-15-2008, 09:19 AM
tnygren's Avatar
tnygren tnygren is offline
Registered User
Join Date: May 2005
Posts: 1,408
Hi Dogchainx,

There is a new method to send function keys in SecureCRT 6.1.x that will allow you to simply specify the key itself.

For example:

CRT.Screen.SendKeys ("{F2}")

This will send the F2 key as specified in the session being used. As long as the F2 key works correctly in the session, it will be sent correctly in the script.

Older versions do require a different method based on what the F2 key is configured to send to the remote system.

Which version of SecureCRT is installed?


Teresa Nygren
Reply With Quote

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:17 AM.