Toggle Mohave Light Dark

The following script works with every app except Keyboard Maestro, WHY? Is there a fix? Doesn't work as a text or an app or a text file.

tell application "System Events"
   tell appearance preferences
      set dark mode to not dark mode
   end tell
end tell

Dark mode doesn't come freely or automatically with Mojave.

Mojave provides an API with which developers can, if they choose, implement a dark mode. Not all developers choose to do that, or give a high priority to it in their development plans.

It sounds as if KM is just the first app you have encountered in which a dark mode is not implemented. You are likely to find others.

I could care less that KM implements the dark mode.

I want to control the dark mode with a keystroke!

System Dark mode toggling fine here from an Execute an Applescript action:

Perhaps an automation permission hasn't yet been set ?

I don’t have “Execute an Applescript action:”

I have no idea what "automation permission” is or where to find/set it.

Why would that be different for KM and AppleScript?

Script runs fine from AppleScript.

See in the Execute folder of the actions dialog.


(If Mojave hasn't yet set a permission for control by KM it will prompt you)

I was looking for "Execute an Applescript action:” in the All actions folder when I said didn’t see it.

The script has been in the "Execute an Applescript” action all along.

It would seem that (If Mojave hasn't yet set a permission for control by KM it will prompt you) is a non-issue.

Just to be sure I did a Restart, still fails. All I get with pressing the hot key is an error chime. I have tried several different hot key combos.

I am not a novice, currently I have and use most of 209 macros.

Found the problem.
The macro was in an obscure Group.

1 Like

Well caught