Sunday, April 25, 2010

SendKeysCtypes release (for some value of released)

I finally got around to releasing SendKeysCtypes (Sending key strokes to the active app on Windows) to http://bitbucket.org/markm/sendkeysctypes.

There is no setup.py yet, it is not registered on PYPI - but at least it is available.

I did a quick check and had to make a small change to make it work on Python 3.1 :)

Give it a try.

I would like to thank Oliver Rutherford for his sendkeys module (http://www.rutherfurd.net/python/sendkeys/) which I have used for years as part of pywinauto.

I only just realized while writing this that it is also posted to bitbucket http://bitbucket.org/orutherfurd/sendkeys)

The main benefits between this module and Oliver's that I can think of are:

  • No compilation required (works on Python 3)
  • Support for Unicode Characters

Code that works for one of these modules should work for the other also


import SendKeysCtypes
import os, time
os.system("start notepad.exe")
time.sleep(.5)
SendKeysCtypes.SendKeys("Hello in Notepad", with_spaces = True)
SendKeysCtypes.SendKeys("%f") # ALT + F "File" menu
SendKeysCtypes.SendKeys("x") # Exit

No comments:

Post a Comment

Post a Comment