• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Output Audio Device
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Output Audio Device


  • Subject: Output Audio Device
  • From: Adam Bell <email@hidden>
  • Date: Wed, 01 Nov 2006 13:48:51 -0400

Title: Output Audio Device
Gurus all;

When headphones, external speakers, or neither of the above (internal speaker) are connected, the Sound pane of System Preferences indicates the change. To be able to detect the configuration from an AppleScript, however, the only means I've been able to find is this one:
-----
activate application "System Preferences"
tell application "System Events" to tell process "System Preferences"
  click button "Sound" of scroll area 1 of window "System Preferences"
    delay 1
set S to value of text field 1 of row 1 of table 1 of scroll area 1 of tab group 1 of window "Sound"
end tell
-----
where the value of 'S' will be 'Internal Speakers', 'Line Output', or 'Headphones', depending on the hardware setup.

That's a rather brute force approach (which only works, BTW, if System Preferences is not running when it's invoked). Clearly, the built-in BurrBrown PCM3052 card that handles Line Level Input, SPDIF Digital output, Headphones, Internal Speakers, and Line Level Outputs communicates with the preference pane (or the Preference Pane queries it directly), but the result is not shown in com.apple.soundpref.plist since the preference is clearly a function of the hardware arrangement - you can't use the internal speaker if something else is plugged into the audio card - the switch over is electromechanical.

That much fiddling leaves me with two questions:

1. Is there a cleaner way to open the sound pane directly?
2. Is there a less cumbersome way to detect that setting from a shell script without running the System Preferences.app?
--
Adam Bell
Tested on a dual-core G5/2.3GHz Power Mac running OS X 10.4.8
 _______________________________________________
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/mailman//archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: Output Audio Device
      • From: kai <email@hidden>
  • Prev by Date: Re: Using the apple built in camera as a security camera
  • Next by Date: Re: Using the apple built in camera as a security camera
  • Previous by thread: Re: Ejecting the tray on CD/DVD Drive
  • Next by thread: Re: Output Audio Device
  • Index(es):
    • Date
    • Thread