traveler has asked for the wisdom of the Perl Monks concerning the following question:

I have seen modules for testing GUIs. One example is X11::GUITest and IIRC, there is one for win32. I want the opposite. I want to have a perl script that watches an arbitrary program (binary) and checks to see if, say, the File menu was selected, or whatver. I guess I want to instrument the GUI of an arbitrary application. Under X, I could probably parse the xev output, but I kind of need a Win32 tool. CPAN and SuperSearch haven't turned up anything.

My ultimate goal is to be able to see if the user pressed, for example, "Print Preview" before doing a "Print". This is for training, not Big Brothering.

Any ideas for existing code or modules that might help? --traveler

Replies are listed 'Best First'.
Re: Watching for GUI events
by tall_man (Parson) on Apr 24, 2003 at 21:32 UTC
    I would suggest using a Windows program to track events like spy.exe or spyxx.exe, and then filtering the interesting events with a perl script.

    Update: There are Win32::GuiTest and Win32::CtrlGUI on CPAN, but they look like they're for sending events rather than monitoring them.

      Yes, those are for monitoring. I looked on google for spy.exe and could only find some sort of DOS network monitor under the name spy.exe. It is not included in my XP. Where do I find it?
        The spyxx.exe program comes with Microsoft Visual Studio. I have it under:

        "C:\Program Files\Microsoft Visual Studio\Common\Tools"