Toggle System Clock to Analog

Hi Everyone,
I’m trying to change the default clock to analog, This doesn’t seem to work on macOS 13.2.1. I tried the following in the terminal and could only find the following.

find menuextra
    Found 6 keys in domain 'com.apple.menuextra.clock': {
        FlashDateSeparators = 0;
        Show24Hour = 0;
        ShowAMPM = 0;
        ShowDate = 1;
        ShowDayOfWeek = 1;
        ShowSeconds = 1;

set currentValue to ¬
(do shell script ¬
	"defaults read com.apple.menuextra.clock 'Analog'") ¬
	as integer as boolean

do shell script ¬
"defaults write com.apple.menuextra.clock 'Analog' -bool " & (not currentValue) & ";"

TIA
Jack

The key is “IsAnalog”. The following works on my Ventura computer:

-- toggle digital and analog
set currentValue to (do shell script "defaults read com.apple.menuextra.clock 'IsAnalog'") as integer as boolean
do shell script "defaults write com.apple.menuextra.clock 'IsAnalog' -bool " & (not currentValue) & ";"

-- set to analog
-- do shell script "defaults write com.apple.menuextra.clock 'IsAnalog' -bool true"

That didn’t work for me. So I tried this.

set currentValue to (do shell script "defaults read com.apple.menuextra.clock 'IsAnalog'") as text
if currentValue is "1" then
set newValue to "false"
else
set newValue to "true"
end if
do shell script "defaults write com.apple.menuextra.clock 'IsAnalog' -bool " & newValue

Jacck. I retested my modification of your orginal script–both from within Script Debugger and as an app on the desktop–and it worked fine. There are a few instances in which the script would not work, and the following should fix those:

try
	set currentValue to (do shell script "defaults read com.apple.menuextra.clock 'IsAnalog'") as integer as boolean
on error
	set currentValue to false
end try
do shell script "defaults write com.apple.menuextra.clock 'IsAnalog' -bool " & (not currentValue)
1 Like

Thanks, This works. :+1: