Home > Archive > PERL Beginners > May 2004 > help with Expect
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
| Yi Chu 2004-05-21, 6:30 pm |
| Does anyone know the mailing list for beginners for Expect? Or some of you may know the answer to my question, I just ask the question here.
How to send function key in Expect program?
Example:
send "Tab()\r"
would send the tab character. But how to send in F5 key?
Tried
send "PF5()\r"
with no luck.
Apologize for asking non-perl question, but I just can not find a good mailing list for Expect. Had good experiences with perl list, so try my luck here.
yi
---------------------------------
Do you Yahoo!?
Yahoo! Domains - Claim yours for only $14.70/year
| |
| Cedric Godin 2004-05-22, 1:33 pm |
| On Friday 21 May 2004 23:41, Yi Chu wrote:
> Does anyone know the mailing list for beginners for Expect? Or some of you
> may know the answer to my question, I just ask the question here.
>
> How to send function key in Expect program?
>
> Example:
> send "Tab()\r"
> would send the tab character. But how to send in F5 key?
>
> Tried
> send "PF5()\r"
> with no luck.
>
> Apologize for asking non-perl question, but I just can not find a good
> mailing list for Expect. Had good experiences with perl list, so try my
> luck here.
>
> yi
>
>
> ---------------------------------
> Do you Yahoo!?
> Yahoo! Domains - Claim yours for only $14.70/year
tip from the expect site:
To send function keys, you need to know one more thing - what characters are
assigned to a function key. Function keys are generally specific to the type
of terminal (or terminal emulator) you are using, so it's easiest to just try
pressing the function key and see what you get. In order to get the clearest
picture, I use the od program to help me. Here are the steps I use:
start od with the -c option
press the function key
press the return key
press ^D
Here's what it looks like when I do that to find out what my F1 key generates:
% od -c
^[[11~
0000000 033 [ 1 1 ~ \n
0000006
%
The string between the 0000000 and \n is what we want. You can translate that
into a send command like this one:
send "\033\[11~"
Notice that the 033 was an octal specification already so I put a backslash in
front of it to tell Tcl to treat it that way. I also put a backslash in front
of the [ to prevent Tcl from trying to execute the next thing as a command.
hope it helps.
--
You can build more secure systems as long as you want, evolution will develop
the better idiot. -- Jan Wieck
|
|
|
|
|