Jump to content

dvd

Member
  • Posts

    4
  • Joined

  • Last visited

Posts posted by dvd

  1. Me again. I have this working now. I created dndenabled.scpt using the AS pasted below. I then run that from dndenabled.sh using:

     

    osascript dndenabled.scpt

     

    dndenabled.scpt:

    tell application "System Events"
    	tell process "Control Center"
    		try
    			if exists menu bar item "Do Not Disturb" of menu bar 1 then
    				return "enabled"
    			else
    				return "disabled"
    			end if
    		on error
    			return null
    		end try
    	end tell
    end tell

     

  2. Forgot to paste some code:

     

    tell application "System Events"
    	tell process "Control Center"
    		try
    			if exists menu bar item "Do Not Disturb" of menu bar 1 then
    				display dialog "DND is on"
    			else
    				display dialog "DND is off"
    			end if
    		on error
    			display dialog "error"
    		end try
    	end tell
    end tell

     

    It takes a couple of beats for it to be added/removed from the menubar, so doesn't work if you run it too quick after changing state.

  3. I use this script a lot so I was bummed when it broke.

     

    I'm not really a mac scripter so I'm flailing around a bit looking for options. Here's one path for a fix that I've been playing around with: If you go to the Dock and Menu Bar system pref, and then choose Do Not Disturb in the sidebar, you can set it so that the DND icon appears in the menubar when DND is active. Then, you can access that menubar item via Applescript UI scripting. So, that's a hacky way to check DND status. 

     

    A couple of other things I notice, but don't really know what to do with. There's a Control Center app. Is that new? I don't know if that offers any solutions. Also there's a com.apple.controlcenter.*.plist.

×
×
  • Create New...