UPDATE: Help needed improving my "Toggle Edit Mode" Macro for KM-Editor

Germany, Wed, 2020, July 15th

Moved Discussion from Topic Facing KM-Problems using macOS HighSierra 10.13.6

Topic Head will be edited after @JMichaelTX has moved related part of the old topic into this Thread

T.Zittlau alias Nr.5-need_input

Germany, Thur, 2020, July,16th

###--~~~Topic Update~---------###

Toggle Editing Mode.kmmacros (34,9 KB)

When I made this Macro I wanted just a quick solution for Toggling the Edit Mode in KM, pressing ⌃⌘E - and decided to do a Re-Edit later for quite more power like getting Info what Column I am in and let the macro do the Column switch for me to the Group Column automatically if editing Macros is enabled and then disable editing.

It seems that is a good solution if you're not very familiar with KM to learn something and understand how things can be done with it. My problem here is that it is sometimes working - sometimes not .... and if it works it takes very too much time to occur.

for more details about that you can go here and get background info

So I decided to ask the community for help Improving it to my needs.

Thank you for your Help

Nr.5-need_input

Okay I understand - that's explaining why I get that Error Message.

Thanks a lot @peternlewis.

Maybe you could help me improving my macro? Or maybe you @JMichaelTX?
When I made it I was searching for a quick and simple way to enable/disable the Edit Mode. But as you can see above it will take a very long time to occur - and as I said before it often doesn't ...
My Plan to improve it is to figure out whether the Group-, Macro- or Actions-Area is selected (enabled Edit Mode) and then it should select Group-Area before disabling the Edit Mode or just disable it if the Group-Area is already selected. Maybe there have to be 1 or 2 AppleSripts for checking? - I am asking because I really don't know how to set that up....

That would be nice....

Thank you for your time

Greetings from Germany

I've been using this fairly simple macro for…checks macro inspector…almost three years. Maybe it will work for you too:

Edit Selected Macro.kmmacros (2.3 KB)

2 Likes

Hello @gglick thanks for such a fast suggestion from your point of view.... looks like a regex-based solution - is that right?

it sounds good... can this be combined with my suggestion? - my goal for that macro is that I am always in Group-Area when opening KM to edit Macros or even creating new ones ....

Thanks for your reply

You're welcome. Yes, it uses regex, and in my testing, it works no matter what is selected; macro group, macro, or action(s).

Sounds Great .... but how do I get the Area - Information for parsing Ito Variables so that the macro will ro a sub-routine based on the given Value ?

After @gglick’s action, do something like:

  • If menu with path View ➤ Stop Editing Macros is enabled and menu with path View ➤ Select Groups Column is enabled
    • Type Key Command-Option-G (or Select View ➤ Select Groups Column)
1 Like

Thanks @peternlewis, Is this eve possible checking the column before @gglick ´s suggestion with all Possibilities? - I just want to be sure that Groups column is ALWAYS selected before disabling Edit Mode.

Sure, you can do it either way.

Okay thank you, I´ll try this .... what do yo think about my idea using a script (AppleScript?!) - I thought it maybe would increase the speed for referencing the Menu Items before selecting them.... just to avoid the Spinning Wheel of Death? - As I said I don't know how to do that - if it can be done like I am suggesting I would appreciate if someone here could help me with that?

I'm not sure using an AppleScript to select the macro group instead of @peternlewis's suggestion of invoking the menu will make much difference, but if you want to try it, here's one that should work:

tell application "Keyboard Maestro"
	select macro group of item 1 of (get selected macros)
end tell

No @gglick .... I DO NOT want use AppleScript instead of .... I want use AppleScript to get the Focus of the selected Column (i.e. Actions) and want the script also check the menu Items before they are selected outside of the script....

As you can see above in both GIFs is that the current macro Version needs round about 1 minute to occur with just "Select Menu Item" Action.... so to me it is clear that KM Engine is struggling to find an existing Menu just using this kind of Action....I don't know why - but it is a fact ...

I did not realise you could use a REGEX expression inside a simple select menu function.
This must simplify the coding for some apps where you just want to toggle the setting
e.g. Start to Stop, Stop to Start etc within a drop down menu.

PS can you check vIa Regex for the tick, or the diamond or nothing OR
does the Regex only work on the first character of the menu item???

OK, per OP's request, I have moved posts from Facing KM-Problems using macOS HighSierra 10.13.6 that concern the subject of this topic to this topic.

See the docs on the Select or Show a Menu Item action.

Note that you can select Help from the Gear menu in any action to get documentation on it.

See the Menu condition for docs on it and the options available. If you hold down the Option key while selecting from the Add Condition (+) menu, you get help on any of the Conditions. This also works for Collections, Triggers, etc.