Open a menu item in QuickBooks

I'm trying to create a shortcut for scanning a bill into Quickbooks for Mac.
The Enter Bills Window has a "Attach" button, which brings up a window with a "+" button that brings up a menu with the "Scan" button that I would like to click that finally brings up another window that has the actual "Scan" button on it.
I've tried Move and Click with Image as a target with limited success.
how do I tell what the name of a button is so I can possibly use 'Press Button' Action?
or is there another way of doing what I need to?

See this video for the workflow I'm trying to automate.

"Move and Click with image as target" is tricky to master. And it's also tricky to give advice on the right image to pick when I can't see the image. There are some techniques that can work around these problems. If you show an image of the screen with the button we might be able to give advice on what part of the image you should be choosing to search for. I've been using "Move and Click with Image as target" every week for over 5 years, so I have some experience with its quirkiness. EDIT: OOPS, I see you did post a video. Let me look at it. Okay. I've looked at it. One issue with your video is that your video truncates the right half of the pop-up window. That may not seem important to you, but it's important to me, because there might be something on that side of the window to assist with the best selectable image. Are you willing to show us the whole window?

As for the name of the button, the easiest way to find it is to look through the menus and see if it has a documented shortcut. Even easier, you can guess what the name of the shortcut might be and enter that word into the Help search box and that can find it even faster. However the best solution is to open the QuickBooks app from inside the Script Editor app and see if it has an associated name in its AppleScript dictionary. If it does (50% chance) then you can invoke it quite easily and very reliably from a KM "Execute AppleScript" action. I can't help with this option because I don't have QuickBooks.

This is my best advice. There are real experts on this website who can probably give even better advice. But try these ideas.

Hey Greg,

Firstly – welcome to the forum!  :sunglasses:

@Sleepy is correct to ask if you've looked through all the menus to make certain there's not a menu command available.

Assuming you've done your due diligence on that...

Keyboard Maestro doesn't have a button detector, and its press a button action can't see into every UI widget on macOS.

When doing detective work on the macOS UI I use UI Browser, Script Debugger, and sometimes the Accessibility Inspector.app from Xcode.

Personally I'd try to use AppleScript UI-Scripting to do this, but that's a row to hoe for most folks.

Here's a place to start with that:

Front Window Analysis Tool Using AppleScript System Events (List UI Elements)

-Chris

Thanks for the quick response @Sleepy .
I've attached a image of the whole window.
there is no menu item that will let me scan a document or even open the attachment window, trust me, I've looked!
but there is a Apple Script Dictionary which I only found after you mentioned it.
I looked through it, but I don't know AS well enough to know if there's anything there that can help me.

@ccstone I downloaded UI Browser and got the following results...

Right-click on the QuickBooks app and select Show Package Contents – then search for β€œsdef” (without the quotes).

Zip the file and post it here.

Here you go.
QuickBooks.sdef.zip (3.7 KB)

Unfortunately I see no signs of access to β€œscan” in the dictionary.

Ok, so the evidence seems to suggest that AppleScript is not an option. So we move to "plan C"... Image Searching.

What we need to do is plan out how to move the mouse to an image and click. What most people probably think is that we have to click directly inside the found image... but this is not true at all. For example, we could use the image search action to find the magnifying glass icon in the upper corner of the pop-up and click 200 pixels below it. This is why I wanted to see your whole window, because I'm looking for the most unique part of the window to search on. Part of the problem is that we can see the pop-up window is translucent, but that's not a fatal problem because the KM image search ability is very capable at covering approximate matches.

Before I go on, I'd like to point out that you may have better results if you turn your screen background to a solid black. That's because the translucency of the pop-up window won't show as much blue. However your blue is fairly dark and I don't think it should matter too much. But I mention this as a way to get you think about making the match more likely to work.

I can see different reasons for choosing different parts of the pop-up window as the search image. I'm not sure what you tried searching for, nor am I sure what you meant by "I had limited success." The "+" button has some good contrast, which I think should work, but if it doesn't work we have other options.

So my first action would be to locate the plus button by searching for an area that includes the plus button and some of the area around it. Here's what I would search for:

Screen Shot 2021-11-23 at 12.39.20 AM

Notice that my search included the minus button and some dark area above the plus button. This helps with searches by eliminating false positives. Let me know if this works for you in terms of locating the plus button. If it works, we can then move on to the next buttons.

The subsequent steps will be easier if this step works, so try this first.

Whups. I missed this. It looks doable.

@Sleepy I got it working with these helpful hints. thank you.
but I have my computer set to automatically switch between light and dark mode.
is there a way of checking what mode the computer is currently set to and do a different set of instructions based on the current mode (Light or Dark)?

Yes, there's a function:

Thanks. That's the second person today to thank me for helping give advice to help them write the code they needed. I think I'm on a roll. I like giving tips and guidance rather than just writing the code for people, that way the feeling of success is shared.