in reply to Enable S-Video output
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.#!/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}");
(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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
"click a button"
by Mr. Muskrat (Canon) on Jan 04, 2004 at 23:15 UTC |