2

Trying to have a script I can use with a shortcut to disable badge notifications on multiple apps for when I need to focus - like for example in a meeting, etc. I don't want to have to go into multiple apps or settings each time I need to focus. I found a solution from prior MacOS but since Ventura made changes to System Settings etc this does not work.

This question's solution is exactly what I am looking for but updated to Ventura. Remove multiple app badge icons with one script?

        set appNameList to {"Calendar", "Games", "Mail", "Messages"}

if running of application "System Preferences" then
    quit application "System Preferences"
    delay 1
end if
tell application "System Preferences"
    set the current pane to pane id "com.apple.preference.notifications"
    delay 1
    tell application "System Events"
        tell table 1 of scroll area 1 of window 1 of application process "System Preferences"
            repeat with i from 2 to (count rows)
                select row i
                delay 0.25 --   # Do not set any lower, increase if necessary!
                set theValue to (value of static text 1 of group 1 of UI element 1 of row i)
                repeat with thisApp in appNameList
                    if theValue contains thisApp then
                        --  # Use 0 with clickCheckBox() to check the check box.
                        --  # Use 1 with clickCheckBox() to uncheck the check box.
                        my clickCheckBox(1)
                    end if
                end repeat
            end repeat
        end tell
    end tell
    quit
end tell

on clickCheckBox(i as integer)
    tell application "System Events"
        tell group 1 of window 1 of application process "System Preferences"
            --  # if the value of checkbox is 0, it's unchecked.
            --  # if the value of checkbox is 1, it's checked.  
            if value of checkbox "Badge app icon" is equal to i then
                click checkbox "Badge app icon"
            end if
        end tell
    end tell
end clickCheckBox

I also need to be about to turn them back on after... Thanks for any help you can provide!

0

You must log in to answer this question.

Browse other questions tagged .