Win32-AutoItX

 view release on metacpan or  search on metacpan

lib/Win32/AutoItX.pm  view on Meta::CPAN

package Win32::AutoItX;

=head1 NAME

Win32::AutoItX - Automate the Windows GUI using AutoItX

=head1 SYNOPSIS

    use Win32::AutoItX;

    my $a = Win32::AutoItX->new;

    ### AutoItX native methods ###

    my $pid = $a->Run('calc.exe');

    my $clipboard_text = $a->ClipGet;
    $a->ClipPut("Win32::AutoItX rulez!");
    
    my $color = $a->PixelGetColor(42, 42);

    ### Perlish methods ###

    my $window = $a->get_window('Calculator');
    $window->wait;
    for my $control ($window->find_controls) {
        local $\ = "\n";
        print "Control $control";
        print "\thandle: ", $control->handle;
        print "\ttext: ", $control->text;
        print "\tx: ", $control->x, "\ty: ", $control->y;
        print "\twidth: ", $control->width, "\theight: ", $control->height;
    }

    my $button_2 = $window->find_controls('2', class => 'Button');
    my $button_3 = $window->find_controls('3', class => 'Button');
    my $button_plus = $window->find_controls('+', class => 'Button');
    my $button_eq = $window->find_controls('=', class => 'Button');
    my $result = $window->find_controls('0', class => 'Static');

    $button_2->click;
    $button_3->click;
    $button_plus->click;
    $button_3->click;
    $button_2->click;
    $button_eq->click;

    print "23 + 32 = ", $result->text, "\n";



=head1 DESCRIPTION

Win32::AutoItX helps to automate the Windows GUI using the AutoItX COM
interface. To use this module you have to install AutoIt v3
(https://www.autoitscript.com/autoit3/) or register the AutoItX COM/ActiveX
component.

On the first constructor (L</new>) invoke it tries to initialize the COM
library. To avoid issues with the security context don't import L<Win32::OLE>
module in the same script using C<use>.

=cut

our $VERSION = '1.01';

use strict;
use warnings;

use Carp;
use Win32::AutoItX::Window;

my $initialized;

=head1 METHODS

=head2 new



( run in 2.511 seconds using v1.01-cache-2.11-cpan-84e82930d8c )