Sending keytrokes to Windows app

Marten Hedman marten.hedman at btk.utu.fi
Mon Apr 4 07:04:43 EDT 2005


Hello,

I am trying to control a Windows application from a python script with 
SendKeys and Python 2.3. My problem is that the characters ':' and '\' 
are sent to the application as ';' and '+'. See code example below.

I suspect that the problem has to do with the regional and keyboard 
settings in Windows. I am using the setting English (UK) with Finnish 
keyboard. If I change the settings to English (US) with US keyboard, 
everything works fine.

Is there a way to either change the language and keyboard settings from 
my python script, or get Sendkeys to send the characters correctly? Or 
should I use another way to send the keystrokes to the application?

Transcript of Python session:

Python 2.3.5 (#62, Feb  8 2005, 16:23:02) [MSC v.1200 32 bit (Intel)] on 
win32
Type "help", "copyright", "credits" or "license" for more information.
 >>> import SendKeys
 >>> a='C:\\'
 >>> SendKeys.SendKeys(a)
 >>> C;+

Thank's in advance

Marten Hedman
Turku Centre for Biotechnology
Turku, Finland



More information about the Python-list mailing list