Re: Looking for Sound Preference magic
Re: Looking for Sound Preference magic
- Subject: Re: Looking for Sound Preference magic
- From: Christopher Stone <email@hidden>
- Date: Fri, 24 Nov 2017 17:05:47 -0600
On 11/24/2017, at 15:42, Robert Poland <email@hidden
<mailto:email@hidden>> wrote:
> For the jillionth time I again had to go the System Preference/Sound and
> enable the Show volume in menu bar. Does anyone have a script or Keyboard
> Maestro command that could be used to automatically do this operation”
Hey Bob,
Easy enough.
-------------------------------------------------------------------------------------------
# Auth: Christopher Stone
# dCre: 2017/11/24 16:40
# dMod: 2017/11/24 16:48
# Appl: Miscellaneous
# Task: Open Volume Menu Extra
# Libs: None
# Osax: None
# Tags: @ccstone, @Applescript, @Script, @Finder, @Open, @Volume, @Menu,
@Extra, @Sound, @System
-------------------------------------------------------------------------------------------
set volumeMenuExtra to ((path to system folder as text) &
"Library:CoreServices:Menu Extras:Volume.menu:")
tell application "System Events"
tell application process "SystemUIServer"
tell menu bar 1
set volumeExists to menu bar items whose accessibility description
contains "volume"
end tell
end tell
if volumeExists = {} then open file volumeMenuExtra
end tell
-------------------------------------------------------------------------------------------
All of the stock macOS menu extras are in that same folder.
You don't really need to test for the volume menulet, because opening it when
it's already running won't do any harm.
But I've included the test just to be thorough.
There is some code worth looking at on this page:
https://www.jamf.com/jamf-nation/discussions/10576/menu-bar-customization
<https://www.jamf.com/jamf-nation/discussions/10576/menu-bar-customization>
However — the guys are reading the SystemUIServer plist to detect whether
menulets are loaded or not, and this is not a fully reliable method if changes
have been made and the system not rebooted.
Because — preference changes aren't necessarily flushed to disk when they are
made.
(The plist test ought to be fully effective on a freshly booted machine.)
--
Take Care,
Chris
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden