I think that this is a joke, but you can never be too sure these days - a small but vocal number of Americans seem to have gone insane recently.
Via Pensieri di un minore lunatic.
That's it, it's official. I'm single forever.
I was talking to Freja, my eldest (six) at the weekend. I can't remember how we got to this part of the conversation, but she told me that I was not allowed to have a girlfriend.
"Why is it that Mummy is allowed a boyfriend," I asked her, "but I'm not allowed a girlfriend?"
"But Daddy, Mummy needs a boyfriend."
I tried to pursue this further, but Freja said "I don't want to talk about it any more", and so that was that.
I'm doing a lot of this at the moment, so I thought I'd jot down some of the stuff I've learnt. Certainly, I couldn't find any of this on the 'net at the moment.
I'm not going to post everything at once - I'll do it a piece at a time.
OK, so you are trying to automate some process, and one of the applications involved doesn't want to play. No COM automation, no command line, no nothing. You are going to have to drive its GUI.
One possibility (the first that I tried) is to use something like AutoIT. This (free) automation tool can drive a lot of things, and a COM control is provided, so you can script it all in Python. Problem is, if you push it too hard, the rough edges start to show. I find I need to reset the control (using the Init() method) all the time, or it would stop recognising windows. One of the applications I'm working with doesn't play by the Windows rules, and so not everything works. Lastly, it's inherently limited - you cannot, for example, use it to get the text from an edit control. For all these reasons, I frequently have to roll my own.
To run this lot, you'll need Python, and Mark Hammond's win32 stuff. I'm using version 2.2.2 and build 152 respectively, on NT 4 service pack 6. If any of this works (or doesn't) on other versions, I'd be grateful to know.
First step - before you can do anything with a GUI component, you'll have to find it. Bit of terminology or you - every Windows GUI component is a window, whatever it is; text area, application window, scroll bar, button, whatever, they are all windows. And each of them has a window handle (often called hwnd). Windows often live in other windows, and can contain yet more windows themselves, so we will end up getting all nasty and recursive. We'll start out by getting a list of the top level windows.
First, we'll import some stuff. We'll need all these modules eventually,
import win32api
import win32con
import win32gui
We are going to use the win32gui.EnumWindows() function to get our top level window information. This is one of those nasty functions which wants a callback function passed to it (consult the docs if you are really bored). So here's one I made earlier:
def windowEnumerationHandler(hwnd, resultList):
'''Pass to win32gui.EnumWindows() to generate list of window handle, window text tuples.'''
resultList.append((hwnd, win32gui.GetWindowText(hwnd)))
We can pass this, along a list to hold the results, into win32gui.EnumWindows(), as so:
topWindows = []
win32gui.EnumWindows(windowEnumerationHandler, topWindows)
Our topWindows list now contains an entry for each of the top level windows, probably quite a lot of them. Go on print it out. Each entry has the windows handle, and the window text, which we'll use to decide which top level window we are going to dig into. Once we have this, we'll use win32gui.EnumChildWindows() to burrow down to find whichever control we want to do something with.
But that's enough for one day...
Update: See Driving win32 GUIs with Python, part 1, Driving win32 GUIs with Python, part 2, Driving win32 GUIs with Python, part 3 and Driving win32 GUIs with Python, part 4.
O'Reilly's Java Extreme Programming Cookbook is out. Wort a look, I reckon.
The jUnit chapter is online, and had already given me some things to think about in terms of test naming standards and multi-threaded code testing.
One of the other chapters discusses GUI testing, so that'll be worth looking at too. One of my team has had a look at jfcUnit, but hasn't feed back to the team yet. My current project is very GUI heavy, being partly a pretty front end to a dog ugly (5250) green-screen application. Our current inability to auto-test our GUIs is causing us to spend a lot of time checking stuff manually, and inevitably, problems slip through anyway.
The newsagent at the station didn't have my newspaper this morning. Doesn't happen often, but it's bloody annoying when it does.
Didn't have a Grauniad, either. I don't mind taking the Grauniad occasionally. Makes a nice change. What's more, they've poached David Aaronovitch from the Independent.
But no, they only had the Tory rags, with which I would not soil my hands. (Though I must admit that my hands get pretty soiled reading the Independent - the newsprint makes my hands look like a miner's by the time I get to work.)
My deepest loathing, though, is reserved for the Devils Newspaper.