In this post I actually talk about not one, but three problems I am currently having with a macro. They are all somehow related, so I don't think it makes sense to create separate topics.
I am trying to create a macro that mounts my NAS. It activates Finder and opens a new window with Cmd+N, then hits Cmd+K to activate the "Connect to server..." menu entry. A new window opens where I could enter the IP of my NAS. Since it is already in there from previous connections I just let the macro hit the Return key. Up until here, everything works fine.
The connection process to the NAS itself however sometimes is instantanous (if the HDD is already running) or takes quite some time. When it is done, a new window appears where I can choose a folder to mount, along with "Cancel" and "OK" buttons.
(See German screenshot here)
To wait for that window to appear I'd prefer not to include a fixed pause of, say, 20 seconds to actually hit Return again to mount the highlighted folder. Because then I would need to wait 20 seconds every time - even if the NAS connected immediately.
Instead I tried the "Pause Until Conditions are Met" action with "Pause until ... A button: with this name" - OK - "is enabled."
It doesn't work. According to the debugger this statement never gets true, although I clearly see that window appear, featuring that OK button.
So I exchanged the "Pause until" for a fixed "Pause for 20 seconds" action and added a "Press the button named: OK" action after this. The pause works, but the macro is cancelled, because it failed to find the "OK" button.
Seems to me that both problems have the same cause: The OK button isn't being recognized.
So I resorted to the "Click at Found Image" action using this image:
In normal "Bright Mode", this works. It doesn't work in Dark Mode, however. I figured, this is because of the light grey surroundings next to the button. I then made a new screenshot, closer now, without any surroundings, figuring this piece would look identical in both bright and dark mode:
Well, when you compare the colors, you already see: They don't match. And of course, it again doesn't work.
I am out of ideas. Does anyone else have one?