Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Bruegels Fuckbooks
Sep 14, 2004

Now, listen - I know the two of you are very different from each other in a lot of ways, but you have to understand that as far as Grandpa's concerned, you're both pieces of shit! Yeah. I can prove it mathematically.
Generally, analog automation is limited - e.g. the big problem with macro recorders / screenshot based utilities is "what if the resolution changes, what if the user is using a different OS and that has different button sizes." Screencapture based methods generally suck and are brittle - you can do stuff like try to define the screen capture so it only captures the region of interest, but it's a pain in the rear end.

The quickest and dirtiest way of automating windows UI is to get out a program like autohotkey or autoit. Native UIs will generally have something like a "controlid" or a "classname" for stuff like buttons in windows (and you may be able to see that in spy++), so rather than using coordinates, you'll be able to do stuff like "wait for window to exist containing a certain classid, click on button with certain classid" using the autohotkey script itself. If you recognize where the controls are by class, and position the cursor using this object recognition, it will be much more durable than using screencapture based methods. Similarly, verifying results by using screenshots is usually a bad idea and should only be done if there is no other option.

Under the hood, many native applications windows support MSAA (https://en.wikipedia.org/wiki/Microsoft_Active_Accessibility / UIA for .NET (https://en.wikipedia.org/wiki/Microsoft_UI_Automation). These apis are intended to help stuff like screen reading software, etc. For whatever app you're trying to automate, automation decision tree is something like:

a) Does the app have a COM interface or CLI interface that I can use without loving with UI automation?
b) Does app support MSAA / MUI and have class names for the objects?
c) gently caress it, are coordinates good enough, or do I want to do some kind of other hack?

Vast majority of apps fall under a) or b).

Adbot
ADBOT LOVES YOU

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply