How do I check a box in a dialog? The dialog is a sheet centered on a window.
Use a Click at Found Image action (possibly within an If action that looks for the image before executing the Click at Found Image action). Here’s the basic information https://wiki.keyboardmaestro.com/Found_Image?s[]=click&s[]=at&s[]=found&s[]=image and more help in the Forums here once you’ve got the basics down https://forum.keyboardmaestro.com/search?q=click%20at%20found%20image
Can you please provide more info? What app? What Sheet? What widow?
Screenshot?
Thanks. I'm trying the found image for the first time, but I haven't made much progress. I'm using the Export dialog in SlipBox. I figured I need to learn how matching works when there aren't available images of great variation, because very little in the window is static. Here's a picture of the sheet.
I just want to check or uncheck things like the ID and Separate files buttons. What I find frustrating is that I can use one of these buttons’ name in a conditional to determine whether the check mark needs to be added or not. If I can tell if it’s clicked by name, why can’t I tell the button with the name to click itself? Should I be using GUI scripting?
That's easy once you know a few tricks.
First, KM will look at the screen for EXACTLY what's in the image. So, if the box is already checked, it will be a different look than if it's empty. So, encase your Click at Found Image actions inside an If statement and use the Screen condition. In the below image, for instance, you can see how I've done that with a different application. If the application at the front AND the screen contains the image (a checkbox and its label), then KM clicks 5 pixels down and 5 pixels in from the left of the image--thus checking the box. See the "relative to the found image's top left corner".
For yours, just take tiny screenshots that encompass only the checkbox and its label, like so or , and set KM to click a few pixels in from the top-left, where the empty checkbox field is.
I forgot to say that the image would have to match something in the bottom of the sheet. That’s the only part if the screen that is static between instances of exporting. Is there a chance it’s not matching because it’s a sheet?
OK, I got a couple of the found image clicks to work. Part of my issue was misunderstanding the KM message displayed in Notifications, because not all of the message is available. The end of the message is replaced by ellipses. That may warrant a bug report. I’ll think about it. Thanks.
You can "click" the checkbox. KM calls it "Press Button".
Here's an example.
I don't have your app, so I'm using Outlook 2011 Print dialog as an example.
Notice the checkbox "Pictures in message body" is UNCHECKED.
So, I use these actions to check it IF it is unchecked:
I just tested this and it works fine.
BTW, I really like, and sometimes use, the "Found Image" actions, but only as a last resort.
(sorry @iampariah, but I've got to call 'em as I see 'em. )
Found images are the least reliable means of finding/clicking on something on your screen. They sometimes don't work on other Macs and/or other monitors. If the App happens to change it even slightly, then it breaks.
Let us know if you have any further questions.
OK, I tried that before posting and it didn't work. I'll try again. There's always the chance I had a logical error in the conditional or otherwise. Thanks.
No problem. I didn't realize Press Button would work on checkboxes. I'll have to try it out.
Alas, Press Button doesn’t work with Illustrator’s Preview checkbox in any of the dialogs I’ve tried. Only Click at Found Image does it.
"Press Button" should work in "standard" Mac apps, but occasionally a developer gets cute and uses a "non-standard" UI. In those cases I usually resort to using AppleScript System Events to find and check the checkbox object.
I would love to know how to do this with Keyboard Maestro. Is UI Browser the only way to find these elements or does Keyboard Maestro provide a means to get elements in a window?
Unlike past versions I can no longer generate Applescript that references UI elements since they are all greyed out when I select the element in UI Browser. I don't know how to do this on my own.