FAQ
The following module was proposed for inclusion in the Module List:

modid: Win32::GUIRobot::Easy
DSLIP: bmpOp
description: A module for automating GUI tasks
userid: ZOFFIX (Zoffix Znet)
chapterid: 22 (Microsoft_Windows_Modules)
communities:

similar:
Win32::GUIRobot

rationale:

The module uses and simplifies the use of Win32::GUIRobot and adds
support for interfacing with Windows clipboard. Instead of a
functional interface of Win32::GUIRobot an object-oriented interface
is provided which secludes the image loading of images that the
robot will need to look for. Instead of using several functions for
a particular automated GUI task, instructions are passed to one
method in form of an arrayref which may be stored and reused.
Personally, I wrote this module when I had a need to automate
several GUI tasks in my application fast and my code would get large
quickly and I would lack time to debug. Robot instructions include
easily stuffing some text into the clipboard (pass a scalar ref as
one of the element in the instructions arrayref), dragging the mouse
(a simple hashref with "what button", "from where" and "to where" as
an element of intructions arraref).

The module has been uploaded and has decent documentation if you
would like more information about it.

enteredby: ZOFFIX (Zoffix Znet)
enteredon: Sat Jan 12 14:31:54 2008 GMT

The resulting entry would be:

Win32::GUIRobot::
::Easy bmpOp A module for automating GUI tasks ZOFFIX


Thanks for registering,

Search Discussions

  • Brian d foy at Jan 12, 2008 at 9:38 pm
    [[ This message was both posted and mailed: see
    the "To," "Cc," and "Newsgroups" headers for details. ]]

    In article <200801121431.m0CEVvAb022135@pause.perl.org>, Perl Authors
    Upload Server wrote:
    The following module was proposed for inclusion in the Module List:

    modid: Win32::GUIRobot::Easy
    DSLIP: bmpOp
    description: A module for automating GUI tasks
    userid: ZOFFIX (Zoffix Znet)
    chapterid: 22 (Microsoft_Windows_Modules)
    communities:
    How about Win32::GUIRobot::OO or something like that? That tells the
    user how the module is different from Win32::GUIRobot. :)

    --
    brian d foy (one of many PAUSE admins), http://pause.perl.org
    archives at http://www.xray.mpe.mpg.de/mailing-lists/modules
    please send all messages back to modules@perl.org
  • Zoffix Znet at Jan 12, 2008 at 10:32 pm
    Well, the main point of the module, (in my opinion at least)
    is that it simplifies the use of Win32::GUIRobot, and having
    an OO interface is a part of what I consider being "simplier"

    On Sat, 2008-01-12 at 15:38 -0600, brian d foy wrote:
    [[ This message was both posted and mailed: see
    the "To," "Cc," and "Newsgroups" headers for details. ]]

    In article <200801121431.m0CEVvAb022135@pause.perl.org>, Perl Authors
    Upload Server wrote:
    The following module was proposed for inclusion in the Module List:

    modid: Win32::GUIRobot::Easy
    DSLIP: bmpOp
    description: A module for automating GUI tasks
    userid: ZOFFIX (Zoffix Znet)
    chapterid: 22 (Microsoft_Windows_Modules)
    communities:
    How about Win32::GUIRobot::OO or something like that? That tells the
    user how the module is different from Win32::GUIRobot. :)
  • Brian d foy at Jan 13, 2008 at 11:21 pm
    [[ This message was both posted and mailed: see
    the "To," "Cc," and "Newsgroups" headers for details. ]]

    In article <1200177136.6646.6.camel@zoffix>, Zoffix Znet
    wrote:
    Well, the main point of the module, (in my opinion at least)
    is that it simplifies the use of Win32::GUIRobot, and having
    an OO interface is a part of what I consider being "simplier"
    Yes, but another person looking at the name *::Easy has no idea about
    which dimension you simplied on. :)

    --
    brian d foy (one of many PAUSE admins), http://pause.perl.org
    archives at http://www.xray.mpe.mpg.de/mailing-lists/modules
    please send all messages back to modules@perl.org
  • Zoffix Znet at Jan 14, 2008 at 12:09 am
    Hmr, how about Win32::GUIRobot::OOInstructions (looks bad to me)
    Simple Win32::GUIRobot::OO doesn't address the point of the
    module really. It's not just an OO mod for Win32::GUIRobot
    in one word I'd describe it as "easy" :). It also provides basic
    textual copy/paste features which Win32::GUIRobot does not.

    Consider the following two snippets of code. First uses
    Win32::GUIRobot and Win32::Clipboard and the second
    example uses Win32::GUIRobot::Easy. Both snippets
    accomplish the same task.

    use Win32::GUIRobot qw(:all);
    use Win32::Clipboard;

    my $Clip = Win32::Clipboard;

    my %pics = (
    ok_button => 'pic1.png',
    run => 'pic2.png',
    go => 'pic3.png',
    );

    my %loaded_pics;

    keys %pics;
    while ( my ( $name, $filename ) = each %pics ) {
    my $image = LoadImage( $filename );
    die "Cannot load '$filename': $@" unless $image;
    die "Image '$filename' is of different depth than the screen"
    if ImageDepth( $image ) != ScreenDepth();
    die "Image '$filename' is wider than the screen"
    if ImageWidth( $image ) > ScreenWidth();
    die "Image '$filename' is higher than the screen"
    if ImageHeight( $image ) > ScreenHeight();

    %loaded_pics{ $name } = $image;
    }

    my $wait_ref = WaitForImage( $pics{run} );

    die "Could not find image `run`"
    unless ref $wait_ref and exists $wait_ref->{ok};

    MouseMoveAbsPix( @{ $wait_ref }{ qw(x y) } );
    SendMouse('{LEFTDOWN}');
    MouseMoveAbsPix( $wait_ref->{x} + 10, $wait_ref->{y} + 10 );
    SendMouse('{LEFTUP}');

    $wait_ref = WaitForImage( $pics{ok_button} );

    die "Could not find image `ok_button`"
    unless ref $wait_ref and exists $wait_ref->{ok};

    SendMouseClick( @{ $wait_ref }{ qw(x y) }, 'Left' );
    $Clip->Set("Foos!");
    SendKeys("^v~");
    Sleep(10);

    $wait_ref = WaitForImage( $pics{go} );
    die "Coult not find image `go`"
    unless ref $wait_ref and exists $wait_ref->{ok};

    SendMouseClick( $wait_ref->{x} + 10, $wait_ref->{y} + 10, 'Left' );
    SendKeys("^v~");
    Sleep(10);
    SendKeys("~~");





    Now the exact same task accomplished with Win32::GUIRobot::Easy

    use Win32::GUIRobot::Easy;

    my $robot = Win32::GUIRobot::Easy->new(
    load => {
    ok_button => 'pic1.png',
    run => 'pic2.png',
    go => 'pic3.png',
    }
    );

    $robot->find_do( run => [ { drag => 1, d_x => 10, d_y => 10 } ] );
    $robot->find_do( ok_button => [
    { lmb => 1 },
    \ "Foos!",
    "^v~",
    [10],
    ]
    );
    $robot->find_do( go => [
    { lmb => 1, x => 10, y => 10 },
    "^v~",
    [10]
    "~~",
    ]
    );


    As you can see, despite the OO interface the module
    "Easy'fies" the process.

    I am failing to come up with a better name, but
    in my opinion the proposed Win32::GUIRobot::OO name
    suggests a simple mapping of Win32::GUIRobot functions
    into an object methods which is definitely not what
    Win32::GUIRobot::Easy is about.

    On Sun, 2008-01-13 at 17:21 -0600, brian d foy wrote:
    [[ This message was both posted and mailed: see
    the "To," "Cc," and "Newsgroups" headers for details. ]]

    In article <1200177136.6646.6.camel@zoffix>, Zoffix Znet
    wrote:
    Well, the main point of the module, (in my opinion at least)
    is that it simplifies the use of Win32::GUIRobot, and having
    an OO interface is a part of what I consider being "simplier"
    Yes, but another person looking at the name *::Easy has no idea about
    which dimension you simplied on. :)
  • Brian d foy at Jan 14, 2008 at 8:52 pm
    [[ This message was both posted and mailed: see
    the "To," "Cc," and "Newsgroups" headers for details. ]]

    In article <1200269352.6646.29.camel@zoffix>, Zoffix Znet
    wrote:

    I am failing to come up with a better name, but
    in my opinion the proposed Win32::GUIRobot::OO name
    suggests a simple mapping of Win32::GUIRobot functions
    into an object methods which is definitely not what
    Win32::GUIRobot::Easy is about.
    Okay. I'm not disputing that it isn't easy, just that "Easy" doesn't
    tell the user anything about what they can do with the module.

    If you're providing more and different things than GUIRobot, maybe
    you should have your own name and a completely separate module :)

    --
    brian d foy (one of many PAUSE admins), http://pause.perl.org
    archives at http://www.xray.mpe.mpg.de/mailing-lists/modules
    please send all messages back to modules@perl.org
  • Zoffix Znet at Jan 14, 2008 at 9:57 pm
    Ok, then how about Win32::Automate ?

    I am thinking that I might add a few more of "automation"
    functions. Such us shutting down the computer or opening the browser.


    On Mon, 2008-01-14 at 14:52 -0600, brian d foy wrote:
    [[ This message was both posted and mailed: see
    the "To," "Cc," and "Newsgroups" headers for details. ]]

    In article <1200269352.6646.29.camel@zoffix>, Zoffix Znet
    wrote:

    I am failing to come up with a better name, but
    in my opinion the proposed Win32::GUIRobot::OO name
    suggests a simple mapping of Win32::GUIRobot functions
    into an object methods which is definitely not what
    Win32::GUIRobot::Easy is about.
    Okay. I'm not disputing that it isn't easy, just that "Easy" doesn't
    tell the user anything about what they can do with the module.

    If you're providing more and different things than GUIRobot, maybe
    you should have your own name and a completely separate module :)
  • Brian d foy at Jan 15, 2008 at 10:07 pm
    [[ This message was both posted and mailed: see
    the "To," "Cc," and "Newsgroups" headers for details. ]]

    In article <1200347852.6646.32.camel@zoffix>, Zoffix Znet
    wrote:
    Ok, then how about Win32::Automate ?

    I am thinking that I might add a few more of "automation"
    functions. Such us shutting down the computer or opening the browser.
    Is automation the main use of the module, or just one way that someone
    might use the module? If the main use of the module is to make GUIs,
    the name should say that :)

    --
    brian d foy (one of many PAUSE admins), http://pause.perl.org
    archives at http://www.xray.mpe.mpg.de/mailing-lists/modules
    please send all messages back to modules@perl.org
  • Zoffix Znet at Jan 17, 2008 at 2:15 am
    No the main goal of the module is to automate GUI tasks such
    as clicking the mouse or typing something. I've thought about
    it and simple Win32::Automate is too ambiguous, as I am not
    automating things beyond GUI, or in other words, the module
    emulates a normal user interacting with the computer, as in
    "wait for certain graphic to appear on the screen and press
    appropriate buttons regarding the location of that graphic"

    The way my module came to existence is: I needed to automate
    certain GUI tasks. I've used Win32::GUIRobot, I found it rather
    complicated for "quickie-hacks", I wrote an extension that
    simplified (at least in my opinion) the use on Win32::GUIRobot
    thus I named it Win32::GUIRobot::Easy.

    I've used HTML::TokeParser, I found it complicated to use for
    "quickie-hacks". I was HTML::TokeParser::Simple and it simplified
    the use of HTML::TokeParser.

    I figured the whole *::Easy thing would be straight-forward,
    but apparently it's not, especially because my module does
    a little bit more and leaves some of the features behind. Therefore,
    I propose a name:

    Win32::GUITaskAutomate


    Thank you for your time,
    Regards,
    Zoffix Znet

    On Tue, 2008-01-15 at 16:07 -0600, brian d foy wrote:
    [[ This message was both posted and mailed: see
    the "To," "Cc," and "Newsgroups" headers for details. ]]

    In article <1200347852.6646.32.camel@zoffix>, Zoffix Znet
    wrote:
    Ok, then how about Win32::Automate ?

    I am thinking that I might add a few more of "automation"
    functions. Such us shutting down the computer or opening the browser.
    Is automation the main use of the module, or just one way that someone
    might use the module? If the main use of the module is to make GUIs,
    the name should say that :)

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupmodules @
categoriesperl
postedJan 12, '08 at 2:32p
activeJan 17, '08 at 2:15a
posts9
users3
websitecpan.org...

People

Translate

site design / logo © 2019 Grokbase