WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Sending Keystrokes

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Sendkey to Different Region Keyboard

 Keywords: SendKey Region Regional Keystroke Keyboard Virtual Key Code

Question:

Hi All, I'm experiencing a problem with SendKey(`{ENTER}`). This ought to perform an Enter key sequence. It works perfectly with U.S. keyboard, but it doesn't seem to work regionally. Meaning the script doesn't work on different region like spanish, french keyboard.

Like to know if it is possible not to use sendkey (alternatively) or use sendkey with different regional settings (spanish, french, german keyboard) winbatch verion 2009b, xp pro.

thanks for help in advance..

Answer:

I cannot recreate the issue. I changed region to Spanish(Spain) and keyboard to Spanish International and SendKey(`{ENTER]`) still worked. Maybe something is causing the window focus to change. Try using SendKeysTo instead of SendKey so that you can specify the window to send the key to.

WinBatch translates the SendKey parameters like '{Enter}' to something called a virtual key code and passes that to the operating system. Virtual key codes work with all keyboard and regional settings. This is basically how a keyboard driver works because it translates key scan codes to virtual key codes.

As a matter of good scripting practice, you might consider using the control manager's cPostButton or cClickButton function as they provide finer control than the SendKey function.


Article ID:   W18274
Filename:   Sendkey to Different Region Keyboard.txt
File Created: 2009:05:29:09:45:28
Last Updated: 2009:05:29:09:45:28