How should I troubleshoot a macro toggle which does not work ^Current Editor|None

Hello,
The following toggle does not work: ^Current Editor|None
I checked it 10 times, and I also checked the Scrivener menu to insure that both menu items are active, and the macro is a duplicate of another toggle which works perfectly.
The macro systematically stays on Current Editor
thank you for your time and input

image

If both menu items are available, then the KM Action will pick the first one it finds.

You probably need some type of IF test to determine which menu to use.

1 Like

My apologies for wasting your time. I was confused as usual.

My macro would only apply if a single menu item toggles as per example below : show / hide Binder (another one of my macros which works).

What I want to do is to create a macro which would choose Current Editor if None is checked (see image below), and vis versa. An if test is necessary as you say, but I don't know how to express the if ... then. What would the macro be looking for. I am not asking you to spend time writing the macro. Simply if you could give me a hint as to how to 'express' the if then action.

thanks very much and sorry again for the confusion.

2019-06-13_22-51-11

2019-06-13_22-54-26

What you want is the "If menu item X is marked" condition:

image

1 Like
^Current Editor|None

Will be a regex search (^) for any menu starting with (^) either “Current Editor” or (|) “None”.

The ^ means both “this is a regex search” and “regex match is anchored at the start”. The “|” is a regex “or” operator.

You can select Hide Binder or Show Binder with the menu selection:

Hide Binder|Show Binder

(no “^”). This is not a regex search, and Keyboard Maestro will look for a menu named either “Hide Binder” or “Show Binder”.

You can detect if the None item is ticked with the If Then Else action, and the Menu condition, “menu is marked”.

Use menu path “Navigate ➤ Binder Selection Affects ➤ None”.

2 Likes

yes, Peter, I now understand. The toggle only applies to a single menu item which toggles.
With 2 different menu items, I need to use the if else
thanks for your help

thanks very much ! exactly what I wanted, and I have a better understanding of the conditions action.

the following is what I was looking for and did not know existed

1 Like

I spoke too fast: the macro works once in a while but not consistently. Another strange issue is that the macro is slow, which never happens with my other macros.

I'm not the best qualified to speculate as to why this particular macro is slow (perhaps Peter will care to weigh in while taking a break from preparing 9.0 for release, which I for one am hoping he is devoting the bulk of his attention to at the moment :wink:) but my guess is that it has to do with checking the status of a submenu, as opposed to a top-level menu, and KM having to wait for the submenu to be populated before it can do so. Unfortunately, while I have a license for Scrivener 2 I've never had a need to purchase 3, so I can't do much to test it or look for alternative methods of achieving your goal on my end.

OK. thanks very much. I hope @peternlewis will have time to comment.

As I said, use the “menu path”, rather than the “menu with name”.

The “menu with name” has to, unsurprisingly, look through all the menu items looking for a specific menu item. That is slow because the accessibility API is slow, and menus can be large, sometimes very large with dynamic menus.

But you do not need to look through all the menus looking for the menu because you already know where it is. It is at:

Navigate ➤ Binder Selection Affects ➤ None

So use that menu path instead.

1 Like

I followed your instructions. Sometimes it works, most of the time not.
Strange: sometimes in the app list Scrivener shows up as Scrivener and sometimes as Scrivener 3, although I only have one version of Scrivener in my computer

It may be that the app is not well behaved in building the menus for accessibility. You may be out of luck in that case.

I presume the application is called on disk “Scrivener 3.app”.

One is named based on the display name of the running application (presumable “Scrivener”) and the other on the display name of the file (presumably “Scrivener 3”). Unfortunately, the system “display name” API does not understand that it is an application and has a proper display name and return it to Keyboard Maestro. I looked in to this recently, but it would be prohibitively expensive for Keyboard Maestro to do it.

1 Like

Thank you Peter
I found a workaround, using another menu item, so all is fine.
Please don't waste time on the name change.
I imagine that version 9 is a Herculean task, and thank you for taking the time to post replies to my questions in the forum.