SendKeys Function Key Not Working?

brett429

Registered User.
Local time
Today, 07:10
Joined
Apr 3, 2008
Messages
114
MyScreen.SendKeys ("<Clear>")
MyScreen.SendKeys ("ACCT " + [AcctNo])
MyScreen.SendKeys ("<Enter>")

Ok, so the above coding works perfectly. It sends the word "ACCT" and the content of the AcctNo field to the mainframe and hits the enter key, pulling up the required information.

But when I try to add an F1 key function, it doesn't work. It just sends the word "F1" to the screen; it doesn't hit the F1 key. I've tried it with < > and with { }, but neither works. What am I doing wrong? Thanks!
 
Not sure you can send F keys but what you need to do is to send the keycode. Also some programs don't like sendkeys because they can be construed as being alien.
 
Not sure you can send F keys but what you need to do is to send the keycode. Also some programs don't like sendkeys because they can be construed as being alien.

All the lists of SendKeys special commands I've seen online include the function keys, so I think they should work. What's the "keycode"?
 
All textbox controls have keypress and keydown events you can trap the keycode there associated with the F key.

Does the code work with any other F Key.
 
All textbox controls have keypress and keydown events you can trap the keycode there associated with the F key.

Does the code work with any other F Key.

I haven't tried it with any other function keys, only "Clear" and "Enter"
 
may I ask why you are using sendkeys. It is not the best way of doing things and is pretty unreliable if your CPU hiccups right when it executes.
 
may I ask why you are using sendkeys. It is not the best way of doing things and is pretty unreliable if your CPU hiccups right when it executes.

It's the only way I could think to screen scrape data from a mainframe emulator. And it's been pretty reliable thus far... except for this Function key thing.
 
Not sure I know what that is. But Ok.
 
All textbox controls have keypress and keydown events you can trap the keycode there associated with the F key.

Does the code work with any other F Key.


did you do what was suggested here to get the code for the F Key?
 
Nevermind, I figured it out. For some reason I needed to programmed as <PF1> instead of <F1>.
 

Users who are viewing this thread

Back
Top Bottom