How to Modify AppleScript To Stop Opening the KM Status Menu on the Menu Bar?

I have been using the excellent script below by @appleianer (reference below) to open the screen shade app (to tint screen background) in the Apple Menu Bar (the only way to open the app). It opens screen shade in the Apple Menu Bar which is what I want, but immediately after clicks/opens the Keyboard Maestro icon in the menu bar.

thank you

    tell application "System Events"
	tell application process "Screen Shade"
		tell menu bar 2
			tell menu bar item 1
					with timeout of 0.1 seconds
						perform action "AXPress"
					end timeout
				end try
			end tell
		end tell
	end tell
end tell
do shell script "killall 'System Events'"
tell application "System Events"
	repeat 6 times
		key code 125
	end repeat
	key code 124
end tell

This is not an answer to your question, but I use a little app called 'Bartender'. It sets the location of all those icons and keeps them in the same place even after a reboot.
I haven't tried this yet, but maybe you could use the simple KM action mouse click (with main screen upper left reference point) and then click again for the selection.
Bartender is not very expensive.


thank you Steve. I used to use Bartender but had to delete it because of some conflict (can't remember)

What's the purpose of this bit?

By any chance is KM the menu bar item to the right of Screen Shade? Coz that would explain why "Right Arrow" (key code 124) is activating it.

1 Like

I’m use an app callled QucikShade

It supports shortcuts.

1 Like

I will have a look. thank you.

Yes, you are perfectly right: the KM icon is to the right of the screen shade icon.
In fact I was confused by the second part of the script which I assumed was necessary for programming purposes. I will simply delete it. thanks very much.

It's a sub-menu item selection routine -- "Down-arrow 6 times, right-arrow once to select this thing". With no sub-menu at that position in Screen Shade menu, the OS treats it as a right-arrow at the menu bar level.


great ! thanks very much

@hello @Nige_S
One problem with the background tinting apps is that it darkens the background of screenshots, so I am looking for one which can be quickly turned on and off with a keystroke

Question: So as I understand, do you use the screen shade app just to focus on the active window, and dim/darken everything else?