KM does not recognize a window ... but it actually does

KM is able to execute an action if a certain window (Stichwörter) is in front. KM therefore recognizes the window. This works.

But KM is not able to recognize the same window even though it is open and bring it to the foreground. This does not work. Does anyone understand this?

Just out of curiosity, are you triggering this macro while the Scrivener application is at the front? Or when it is not at the front? Because the circled part of your macro indicates that the macro group only works when you are already in Scrivener. Therefore, if you are trying to use this to bring that window to the front while not only it, but the entire application is in the background, then it won’t work. You would need to change the macro group settings to “available when Scrivener is running” or something to that effect.

Macro Screenshot (click to expand/collapse)

1 Like

Yes, Scrivener is always the front app, with two windows open. The problem seems to be that KM only recognizes the "Keywords" window when it is the front window.

As far as I know, and I really don't know much about this, there are different kinds of "windows." I just tried this, using Safari, and what it did was return the "tab" in the frontmost window of Safari, but it did not find the tab if it was in the secondmost window.

Try putting these actions at the beginning of your macro. The alert will show you the trigger information which will confirm the macro is actually executing, and the debugger will show you more information as the macro proceeds.

Additionally, ensure the macOS permissions have been enabled, and try resetting them if in doubt.

Download Macro(s): Keyboard Maestro Actions.kmactions (862 B)

Macro-Image

Keyboard Maestro Export

Macro-Notes
  • Macros are always disabled when imported into the Keyboard Maestro Editor.
  • The user must ensure the macro is enabled.
  • The user must also ensure the macro's parent macro-group is enabled.
System Information
  • macOS 13.6
  • Keyboard Maestro v11.0.1
1 Like

Thank you both. In the meantime, I have found out that the window can be found reliably with the image search. Maybe not very elegant, but it works and that's good enough for me. :slightly_smiling_face:

Might be a silly question, but does this happen with all documents or could it be an issue with umlauts?

1 Like

It is almost certainly the window itself. It is a special floating window from Scrivener that is not even recognized by AltTab. But it's still strange that KM recognizes it when the cursor is in it, so when it's the front window.

Ah. Have you tried AppleScript?

No, I don't understand anything about AppleScript. Actually, I don't understand anything about anything. That's why I do it with image recognition :joy:

I'm looking for these two unique images. It's working well so far. :slightly_smiling_face:

image

image

Just for fun, what does this spit out when you trigger it while hovering over an element in that window and select "Click"?

Keyboard Maestro recognised the window enough to say it exists.

But the window cannot be made the main window so Bring to Front will not work.

1 Like