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-22-2005, 10:54 PM
quark-man quark-man is offline
Registered User
 
Join Date: May 2005
Posts: 16
Sending The F5 Key ?

I'm just having difficulty getting the right ASCII values to send the following keys:

F3 and F5.

crt.screen.Send Chr(27) & ""
?


I know you'd have to combine 2 decimal values, so just wondering how to exactly do that ?

Char. Decimal Hexadecimal
----- -------- ------------
F3 (00,61) (0x00,0x3d)
F4 (00,62) (0x00,0x3e)
F5 (00,63) (0x00,0x3f)


Any help would be nice.

-----
also, i would like to send a string like "uname -a <CR>", so that's something else i got to figure out too.
:P
Reply With Quote
  #2  
Old 05-23-2005, 11:04 AM
bocks's Avatar
bocks bocks is offline
VanDyke Customer Support
 
Join Date: Jan 2004
Location: Albuquerque, NM
Posts: 184
Hello quark-man,

Quote:
I'm just having difficulty getting the right ASCII values to send the following keys:

F3 and F5.
The codes that get sent usually depend on what type of emulation you are using, and what codes the system you are connecting to expects.

Can you tell me what type of system you are connecting to and what emulation you are using?

Quote:
also, i would like to send a string like "uname -a <CR>", so that's something else i got to figure out too.
:P
This can be accomplished like this:
Code:
crt.screen.send "uname -a" & vbcr
Is this to be part of a script, or mapped to a key?

Can you tell me a little more about what you are wanting to accomplish?

Thanks,

-bocks
Reply With Quote
  #3  
Old 05-23-2005, 06:50 PM
quark-man quark-man is offline
Registered User
 
Join Date: May 2005
Posts: 16
thanks for your quick reply bocks
i figured out sending strings and Carriage Returns.

but is it possible to create the keystroke for the most common Emulations ?
even though most commonly, i/we use VT100.
but since there's keymappings involved, i'd like to simulate the sending of the "F5" key anyway, and maybe then the keymap would map that key and send the keystroke to the Telnet based application.

so, i have been trying to huntdown ASCII or other decimal combinations for F3 and F5.
unfortunately, the "F3" function has not been working.

but i'm determined to try and figure out this, and need some assistance with sending F3 and F5 keystrokes.

Reply With Quote
  #4  
Old 05-23-2005, 06:57 PM
quark-man quark-man is offline
Registered User
 
Join Date: May 2005
Posts: 16
Question

oh,...

here is a snippet from the keymap.key file that i am using when connecting via Telnet (with VT100 emulation) to the server, that is accepting the keystrokes.

thus,
i'm sending a F3 and a F5 to the server, and the server is expecting a key-mapped F3 and F5.

----snip----


S VK_F2 VT_F12
S VK_F3 VT_F13
S VK_F4 VT_F14
S VK_F5 VT_F15
S VK_F6 VT_F16
S VK_F7 VT_F17


N VK_F3 VT_F8
N VK_F4 VT_F9
N VK_F5 VT_F10
N VK_F6 VT_F11
N VK_F7 VT_F12



-----snip-----



i don't fully understand the columns and what they symbolise, but i hope this information helps.
Reply With Quote
  #5  
Old 05-24-2005, 09:49 AM
bocks's Avatar
bocks bocks is offline
VanDyke Customer Support
 
Join Date: Jan 2004
Location: Albuquerque, NM
Posts: 184
Quote:
Originally Posted by quark-man
but is it possible to create the keystroke for the most common Emulations ?
even though most commonly, i/we use VT100
The codes that are sent depend on what emulation is being used. For example, the codes sent for the F3 key in VT100 are ^[OR, while the codes for F3 in Wyse 50 would be ^AB followed by a <CR>.

These codes would break down like this :
Code:
Codes        Reads as      Codes Sent

^[OR      Escape-[ OR      \033OR
^AB       Control-A B      \001 B \015
If you need to send the VT100 codes in a script, you could use something like this:
Code:
'Send F3 character code with CR
ESC_Key= Chr(27)
crt.screen.send ESC_Key & "OR" & vbcr
Quote:
here is a snippet from the keymap.key file that i am using when connecting via Telnet (with VT100 emulation) to the server
...

N VK_F3 VT_F8
N VK_F4 VT_F9
N VK_F5 VT_F10
N VK_F6 VT_F11
N VK_F7 VT_F12
...

thus,
i'm sending a F3 and a F5 to the server, and the server is expecting a key-mapped F3 and F5.
This seems a little odd. What this is showing is that when you press the F3 key, you are sending an F8. You may want to try something like this:
Code:
N VK_F3 VT_PF3
N VK_F4 VT_PF4
N VK_F6 VT_PF6
N VK_F7 VT_PF7
Since the F5 key is not normally mapped in the VT100 emulation, you could try something like this:
Code:
N VK_F5 \033OT
Quote:
I know you'd have to combine 2 decimal values, so just wondering how to exactly do that ?

Char. Decimal Hexadecimal
----- -------- ------------
F3 (00,61) (0x00,0x3d)
F4 (00,62) (0x00,0x3e)
F5 (00,63) (0x00,0x3f)
The codes here look like they are coming from Microsoft's ANSI.SYS from DOS. Are these the codes that you need to send?

If they are, then something like this should work:

Code:
'Send F3 character code with CR
crt.screen.send chr(61) & vbcr
-bocks

Last edited by bocks; 05-24-2005 at 11:23 AM.
Reply With Quote
  #6  
Old 05-25-2005, 11:50 AM
quark-man quark-man is offline
Registered User
 
Join Date: May 2005
Posts: 16
thanks for your response, bocks.
i'll try and simplify this.

i'm using SecureCRT that connects to a server, via Telnet (using VT100).
i send the TAB, F3 and F5 keys a lot.
i have written a VBScript (and it simulates the Carriage Returns, TAB, other characters well) to do some repetitive tasks.
i really need to figure out what VBScript commands/characters to use when i need to send F3 and F5.

i didn't know what the server expects, everytime i pressed F3 and F5 from my end.
on top of this, this particular connection to this server, uses a special keymap setting/file.
i included some bits of the keymap, where i could see the words "F3" and "F5" in...


----snip----


S VK_F2 VT_F12
S VK_F3 VT_F13
S VK_F4 VT_F14
S VK_F5 VT_F15
S VK_F6 VT_F16
S VK_F7 VT_F17


N VK_F3 VT_F8
N VK_F4 VT_F9
N VK_F5 VT_F10
N VK_F6 VT_F11
N VK_F7 VT_F12



-----snip-----


i couldn't understand this keymap and what the columns represented.
but this is what i guess is being used to send those keystrokes to this server, via Telnet (using VT100).

so, my question is, how do i send F3 and F5 (in general, and especially in my case) ???
i tried sourcing the answer, and went through some ASCII sites that showed me decimal/hexadecimal combinations for sending those keystrokes.

i couldn't do it successfully, but i didn't know what i was doing .... let alone read the keymap file.

eventually, i'd like to write a big JScript or VBScript to do some repetitive tasks using SecureCRT.

thanks again, bocks

Last edited by quark-man; 05-25-2005 at 11:53 AM.
Reply With Quote
  #7  
Old 05-25-2005, 06:25 PM
jdev's Avatar
jdev jdev is offline
VanDyke Technical Support
 
Join Date: Nov 2003
Location: Albuquerque, NM
Posts: 1,039
Quote:
Originally Posted by quark-man
i really need to figure out what VBScript commands/characters to use when i need to send F3 and F5.

i didn't know what the server expects, everytime i pressed F3 and F5 from my end.
on top of this, this particular connection to this server, uses a special keymap setting/file.
i included some bits of the keymap, where i could see the words "F3" and "F5" in...
...
N VK_F3 VT_F8
...
N VK_F5 VT_F10
...

so, my question is, how do i send F3 and F5 (in general, and especially in my case) ???

<snip>
eventually, i'd like to write a big JScript or VBScript to do some repetitive tasks using SecureCRT.
Thanks for the info on the special keymap file that you are using.

It appears that your keymap file defines the f3 key as a "VT_F8", which literally translates into the following sequence of ASCII characters:
ESC[19~
To send this sequence, you would use the following:
crt.screen.send chr(27) & "[19~"
Fortunately, you might not have to know exactly what ASCII characters to send to the remote.

Within your script, to send the characters associated with the F3 key (according to your special keymap file), you would use the SendSpecial() function to send the "VT_F8" equivalent, etc. as in the following example:

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

' According to the special keymap file, F3 is really mapped to send a VT_F8
crt.screen.sendSpecial "VT_F8"

' Other examples corresonding to the special keymap file

' "press" F4 (send sequence associated with the F4 key as per the special map file)
crt.screen.SendSpecial "VT_F9"

' "press" F5
crt.Screen.SendSpecial "VT_F10"

' "press" SHIFT+F2
crt.Screen.SendSpecial "VT_F12"

' "press" SHIFT+F6
crt.Screen.SendSpecial "VT_F16"


' There are other things you can do, like copy and paste, and any other
' menu function.  For a list of possibilities, see the default.mnu  file
' located in the menus folder in the SecureCRT installation path.
'
' send contents of the clipboard to the remote:
crt.Screen.SendSpecial "MENU_PASTE"

' Select all and then copy to the clipboard
crt.Screen.SendSpecial "MENU_SELECT_ALL"
crt.Screen.SendSpecial "MENU_COPY"

' Print the screen
crt.Screen.SendSpecial "MENU_PRINT_SCREEN"

' Print the selection
crt.Screen.SendSpecial "MENU_PRINT_SELECTION"
The .key file format is as follows:
MODIFIER KEY VALUE

So, in the following line from your .key file the MODIFIER, KEY and VALUE are None, VK_F3, and VT_F8, respectively:
N VK_F3 VT_F8
In short, you should be able to use SendSpecial() to send anything that begins with VT_ or SB_ within the .key file you have, and in addition it can be used to perform menu functions that would normally require a mouse click or accelerator key to get at.

Does this information help to answer your questions?

Thanks.
__________________
Jake Devenport
VanDyke Software
Technical Support
YouTube Channel: https://www.youtube.com/vandykesoftware
Email: support@vandyke.com
Web: https://www.vandyke.com/support
Reply With Quote
  #8  
Old 05-28-2005, 12:06 AM
quark-man quark-man is offline
Registered User
 
Join Date: May 2005
Posts: 16
Talking

Quote:
Originally Posted by jdev
....
In short, you should be able to use SendSpecial() to send anything that begins with VT_ or SB_ within the .key file you have, and in addition it can be used to perform menu functions that would normally require a mouse click or accelerator key to get at.

Does this information help to answer your questions?

Thanks.
jdev,
thanks so much for that.
that's exactly what i was after, and you've gone above/beyond my queries.
much appreciated.
thanks to you + VanDyke, i was able to achieve those special Function key sending.
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 03:55 AM.