Howdy folks, pretty new to the forum here and to AppleScript in general. I was referred here by @ccstone over from the Keyboard Maestro forum when he turned me on to Script Debugger and UI Browser.
After some tinkering I came up with a script that checks the DND status using the menu bar icon, and saves it to a variable. It works great for me, but am curious if it works for other people and their setups as well. Since it reads one of the attributes of the menu bar icon, I imagine one of the requisites is to have the menu bar icon actually visible there. So I am wondering what proper etiquette here is to asking others to check my script and let me know if it works, of how it can be improved.
Below is the actual script if anybody wants to see it. Any feedback whatsoever is more than welcome, and apologies in advance if a newbie like me isn’t supposed to post scripts.
use AppleScript version "2.4" -- Yosemite (10.10) or later use scripting additions -- Created by Chris Thomerson -- 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 tell application "System Events" get value of attribute "AXEnabled" of menu bar item "Do Not Disturb" of menu bar 1 of application process "Control Center" if value of attribute "AXEnabled" of menu bar item "Do Not Disturb" of menu bar 1 of application process "Control Center" is false then set DNDStatus to "Disabled" else set DNDStatus to "Enabled" end if end tell DNDStatus