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

Hi Monks,
I want to capture user's action,keyboard strokes or mouse clicks.Also I want to know which object the user clicked(a button/listbox/or any window's component).I want to do this on Windows platform.
Is there any such module(s) available for this task?
After capturing all the actions, I shall be repeating those on other machines.(Just like any other automation tool)
thanks in advance
Sam

Replies are listed 'Best First'.
Re: Capturing user actions
by keszler (Priest) on Jul 01, 2004 at 10:53 UTC
    use Win32::GuiTest;

    SendKeys KEYS [DELAY] SendMouse COMMAND MouseMoveAbsPix(X,Y) FindWindowLike WINDOW, TITLEPATTERN, CLASSPATTERN, CHILDID PushButton BUTTON [, DELAY] PushChildButton( parent, button [, delay] )
      The first thing that I need is to RECORD the user's action.Above thing could be useful AFTER recording user's action(PLAY mode).I am in search of this kind of stuff(modules).
      Is there any such facility in perl?
        You can use Win32 for that, just that you need to carefully craft your recorder.
        Here are some function that you may use:
        ($x,$y) = GetCursorPos() * Retrieves the cursor's position,in screen coordinates as (x,y) array. GetCaretPos() Retrieves the caret's position, in client coordinates as (x,y) array. +(Like Windows function) IsKeyPressed($key) Wrapper around the GetAsyncKeyState API function. Returns TRUE if the +user presses the specified key. FindWindowLike($window,$titleregex,$classregex,$childid,$maxlevel) Finds the window handles of the windows matching the specified paramet +ers and returns them as a list. $text = WMGetText($hwnd) * Sends a WM_GETTEXT to a window and returns its contents GetListViewContents($window)
        The point is that you can "record" a session using Win32, it's just not that simple.
        Dodge This!
Re: Capturing user actions
by beable (Friar) on Jul 01, 2004 at 10:24 UTC