Monday, May 11, 2009

Sending Mouse Clicks via Win32::GuiTest

This is a little more difficult than key presses. Many thanks to George Nistorica for his article which you can read here.

# click_mouse ( window, xoffset, yoffset)
sub click_mouse {
my $window = shift;
my $x_offset = shift;
my $y_offset = shift;

my ( $left, $top, $right, $bottom ) = GetWindowRect($window);

MouseMoveAbsPix( ( $left + $x_offset ), ( $top + $y_offset) );

SendMouse("{LeftClick}");
}

No comments:

Labels

Blog Archive

Contributors