Thanks! Sometimes you just need a starting point, which this was for me. I started playing with this and now it is helping me.
#!/usr/bin/perl -w use strict; my @windows; use Win32::GuiTest qw(FindWindowLike SetForegroundWindow SendMouse MouseMoveAbsPix); $Win32::GuiTest::debug = 1; # Set to "1" to enable verbose mode my ($hwindDisplay) = FindWindowLike(0, "^Foo", ""); $hwindDisplay or die("Could not open Foo\n"); SetForegroundWindow($hwindDisplay); MouseMoveAbsPix(140, 380); SendMouse ("{LEFTCLICK}");
I'm using "MouseMoveAbsPix" until I get it to recognize the box name, which it hasn't yet, or until I can figure out the process ID for it, but I can't tell you what a treat it is to get this automated! Looking back at it, it seems so idiotically simple, but at some point you have to actually sit down and make yourself do it. What slowed me down was the fancy brackets ({}) around LEFTCLICK. I didn't see why they were necessary on top of the parens AND quotes (and still don't), but they made it work.

(This is for a job where I am literally supposed to "click a button," to guarantee that the app "Foo" is running. I'll do the alarm programming one of these days, but since this won't work if the app isn't running, I'm not in any big hurry about it. Actually, the "or die" should be enough! Now that I think about it, I will need to add some kind of "wait 1800, repeat" routine too, but I can do that later. Did I mention "lazy"?)

But you were right, I ended up using it for something completely different. And the fun thing is, I have about 20 more routines I am going to apply it to over the next couple of weeks.

Also, if anyone sees a better WTDI, please feel free. I am usually missing something. TIA.

ackme


In reply to Re: Enable S-Video output by ackme
in thread Enable S-Video output by jplindstrom

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.