Preference Not to Display the KM Status Menu

I wonder if my reluctance to display the KM status menu item is making it harder to use KM. Does anyone else share that preference, and if so, how do you manage debugging, etc.? Thanks.

I don't share your preference, but if I were I would probably just make a simple macro to toggle debugging.

Something like below. That way you don't have to worry about clicking into the non-existent KM menu bar icon.

For other debugging issues, like opening the KM log, there are other macros floating around the forum to accomplish that as well.

-Chris

Toggle KM debugging.kmmacros (1.5 KB)

Thanks, Chris!

I used this to make a toggle macro for the status menu. For some reason, I wasn't able to make Show Status Menu action work while KM (10.0.1) is open, so I just used some clicks, so as long as the General Prefpane in KM is mostly the same, this should work. If there's an easier way, please let me know.

This sets two variables (VarKMRunning and VarStatus) and toggles the menu then quits KM according to whether it's running or not when the macro is triggered. I put it in the Global Macro Group, but it could go wherever convenient.

Toggle Status menu Macro (v10.0.1)

Toggle Status menu.kmmacros (24 KB)

Mouse clicks based on position can change depending on screen resolution. Try this basic AppleScript:

It basically clicks all those buttons (and drop down menu) for you, but without relying on coordinates.

The last of the click items has four options, only the first one will execute (never). The other three (alphabetically, group and hierarchically) are disabled with the two dashes preceding them. So this script will disable the menu bar icon. To reenable it, simply put two dashes in front of the "never" line (or delete it completely), and remove the two dashes from whichever option you want (alphabetically, group or hierarchically).

Below is a simple macro that should accomplish disabling the icon. It can be modified much in the way your original macro is to also enable it by making the adjustments to the AppleScript I mentioned above.

EDIT: The revision will now toggle between two options, set from within the AppleScript itself.

----------------------------------------------------------
# Author:				Chris Thomerson
# Current Version:		1.3
#
# Version History:
#						1.3 (Simplified some script to make it faster)
#						1.2 (Setting the preferred display option is now done by setting menuOpt to the corresponding number
#						1.1 (Script will now toggle between two options)
#						1.0 (Initial script)
#
# Created:				Saturday, November 20, 2021
# Modified:				Saturday, November 20, 2021
# macOS:				11.6.1 (Big Sur)
#
# Notes:			
# I claim no responsibility nor guarantee compatibility
# As with any kind of custom scripts, these must be tested thoroughly on each person's device
# May be used and distributed freely
----------------------------------------------------------

----------------------------------------------------------
# List of menu options
# menu item 1 of menu 1 of pop up button 1 of window 1: Never
# menu item 3 of menu 1 of pop up button 1 of window 1: Alphabetically
# menu item 4 of menu 1 of pop up button 1 of window 1: By Group
# menu item 5 of menu 1 of pop up button 1 of window 1: Hierarchically
----------------------------------------------------------

set actDelay to "0.2" -- set the time for the delays between actions
set menuOpt to 4 -- this number corresponds to the option you want from the list above

tell application "System Events"
	tell application process "Keyboard Maestro"
		
		click button 1 of toolbar 1 of window 1
		delay actDelay
		
		set origOpt to value of pop up button 1 of window 1
		click pop up button 1 of window 1 -- click the pop up button
		delay actDelay
		
		if origOpt is "Never" then
			click menu item menuOpt of menu 1 of pop up button 1 of window 1 -- the option set in the variable above
		else
			click menu item 1 of menu 1 of pop up button 1 of window 1 -- click on the never option
		end if
		
	end tell
end tell

KM- Open Preferences Pane and Toggle Menu Bar Icon (for export).kmmacros (6.2 KB)

Hey Laine,

I don't use the Status Menu much, but...

  • I have a macro that opens it for type-selecting some macros I don't use often but want quick access to.

  • I use the Iconaholic Loud icon so I ALWAYS know when Keyboard Maestro is running a macro.
    • This has saved my bacon 2-3 times when a process was taking too long, and I realized it was doing something bad.

I ran for a while without the status menu active, but over the nearly 20 years I've been running Keyboard Maestro I've decided it's not a good idea.

-Chris

1 Like

Yes the main reason I use the status menu is to see when macros are executing, and if they’re taking too long. I don’t actually trigger anything at all from the status menu, especially now that we have macro group menus.

Thanks, Chris!
I don't have trouble remembering my shortcut to Cancel all running Macros, because I use it all the time. I decided to upload the toggle Macro in spite of the fact that there may be display and screen setting that might not let it work. I figured if somebody wants it, they can customize the click actions. I'll probably use the Iconaholic Loud to see if it helps. By the time I finished the toggle macro I was good and mad, as I always am when I work on a macro with more than 5 actions. I know that's not KM's fault, I just barely have enough patience for any kind of macro building. There's always something else it needs, and by then I've forgotten... well, not your problem.
I may use the toggle switch for awhile, now that I have it. Thanks again.

Oops, I forgot. There is one thing that might be your problem. Before I found JMichaelTX's UI script, I tried to get KM to click the General pane of the prefs window from a found image, and that made KM quit unexpectedly as soon as it performed the click. It may be something I should already know about.

Hmm...

Something like that shouldn't crash Keyboard Maestro.

Did the error reporter send the log to Peter?

Also – you can use the Press a Button action for that instead of using a found image.

-Chris

I tried that, must have failed to match the case of "General". Probably gave up after "general" didn't work.

That's one of the issues. It was an unexpected quit, but didn't show a crash. I kept looking to see whether the cursor went to the close button of the wrong window, but it didn't look that way, and I can't figure out how that could have happened, because it was clicking the center of the found image. It's still a possibility, I guess. I can't make it happen now. Transitory issues are almost as bad as intermittent, not quite. Is there a way to confirm from logs what cause the quit?

I made some changes to the macro I posted earlier. Now it will automatically toggle between never showing the menu bar icon, and showing it listed by group.

In the AppleScript itself is a complete list of the 4 options (never, alphabetically, by group, and hierarchically), that way if you prefer one of those other options you can simply swap out the menu item # with the corresponding number.

Let me know if it works for you!

Will do. Thanks!

1 Like

And because I can never leave things well enough alone, I made it easier to set the preferred display option. Version 1.2.

In the first few lines of the script just set the variable menuOpt to the number that corresponds to your preference.

I MAY leave it alone now...or I may continue to tweak it haha.

1 Like

Thanks! I'm not sure that seems easy to me. I'd like to respond right away, but I'll need some time.

No problem! If you do have any questions don't hesitate to reach out (either here or through PM) and I can explain it in more detail.

I like it! I think I'll replace my conditional that handles the Display Status Menu pop-up in General Preferences so I can keep the conditional for whether the macro quits KM Editor.

Sounds like a good idea. You can also change those variables to local variables (in this case local_VarKMrunning) so they don't remain after the macro finishes executing.

OK, well that explains one of the problems I had in my ffmpeg macro. I created some variables without prepending "local_", then expected them to update after I added it. That's a good reason that there should be a way to create a variable in KM in the interface which includes a check box for "local" instead of that clumsy prepending business. I don't suppose there is a check box anywhere in the interface for "local" as it pertains to variables, is there? That's an example of the way that KM often seems to multiply geekiness instead of eliminating it. (leaving rant mode now.)
Thanks again.

No, there isn't. I'm sure there are good reasons that are far beyond my understanding haha.

I really never even used local variables until earlier this year when I got tired of seeing hundreds of variables in my preferences menus. So for several months I went through all of my macros and converted as many of my global variables as possible to local or instance.

Now I have a method to keep variables from accumulating. When I am building a macro or otherwise adding actions that use variables, I have a Typinator expansion that places debug_ before the variable. Once I've verified that the macro works as intended, I have a KM macro that replaces debug_ with local_. I also have a macro that automatically deletes all variables that begin with debug_ whenever the system sleeps in case I forget to delete them manually.