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

Sunday, April 18, 2010

I am speaking at PyCon Asia Pacific in June

I will be speaking at PyCon Asia Pacific.

My talk is titled "Writing Application Plugins in Python". I aim to show how Python can be used to implement plugin functionality for applications that never even heard of Python.

The idea being, that if you write a small amount of shim code (using Pyrex/Cython to make it really easy) then you can pass most of the work off to Python. I work on Windows, and my examples will be on that OS, but very little of what I present will be specific to Windows.

I am still searching around for a good Open Source application with a reasonably simple API/SDK that I can demonstrate with. Leave a comment if you have a suggestion. But the majority of the talk will be generic to any application giving introductions to the various tools and modules used.

If you are in or around Singapoare in June - or feel like seeing South East Asia - then drop by :)

A small library wants to break out of pywinauto

I have been working on pywinauto for about 4 and a half years now and its not really moving in any direction. I make small tweaks here and there and make releases from time to time - but nothing major.

This was the first open source project that I released and I think maybe I was a little over-enthusiastic :). I had hoped that I would be using it myself, I also wished it to be functional and easy enough thatthat it could replace expensive commercial software with similar functionality (but with their own annoying languages). But I am no longer working with said software and my main focus went to other things.

I believe now that pywinauto should be split. There is at least 1 small library (and probobaly more) that should be freed from the overall project.
  • Get information from windows controls (Maybe of the questions on the pywinauto list is how to get the values from text boxes, etc.)
  • A library for automating Windows, not an auotmation framework/language - a library. Meaning that it is up to the user to delay between clicks for windows to open/close. It is up to the user how they want to select controls.
  • SendKeysCtypes (I re-wrote Python SendKeys so that it would support Unicode and not need to be compiled (uses Ctypes). This is more or less ready to release - I just haven't gotten around to doing that :(. (if you need it - grab it from Pywinauto SVN)
  • pywinauto - which would use these previous components but would be much smaller itself, it would work as it does now, trying to help the user as much as possible in not having to worry about timing issues.
Seeing as it turned out that *I* don't really need an automation library/toolkit - it would be great to get some help with some of this work.

Other directions I am thinking of are providing modules so that pywinauto (or the gui automation libarary) can work as an almost direct replacement of things like AutoHotkey or AutoIT or use a similar API as LDTP.

I also need to fix the Pywinauto web presence - which is amazingly scattered - but this post is already long enough.