|
|
#1 |
|
Prospect
Join Date: Dec 2002
Location: Montréal
Posts: 44
|
Regarding this hint An AppleScript to change sound output device. I have create my own script similar to this one to switch the audio output to the iMic (which is the output for my bedroom stereo). The script works great... but only when I'm there. I use iCal to trigger the script as a wakeup alarm. The problem is it does not work the next morning when triggered automatically! AppleScript reports an NSReceiver error #4... I really don't understand why, any ideas?
Here's the code: PHP Code:
|
|
|
|
|
|
#2 | |||||||||||||||||||
|
All Star
Join Date: Jul 2004
Posts: 713
|
FWIW, you should be able to simplify* that: Code:
tell application "System Preferences" activate set current pane to pane "com.apple.preference.sound" reveal (first anchor of current pane whose name is "output") end tell |
|||||||||||||||||||
|
|
|
|
|
#3 |
|
Prospect
Join Date: Dec 2002
Location: Montréal
Posts: 44
|
Thanks for the tip. I have tried it and it seams to work. I've set up a test alarm for tomorrow morning, we'll see if it solves the problem
|
|
|
|
|
|
#4 |
|
Prospect
Join Date: Dec 2002
Location: Montréal
Posts: 44
|
Hmmmm it doesn't seam to have worked... Although it might have been me that screwed up. I'll test again next Thursday (can't right now).
|
|
|
|
|
|
#5 |
|
Triple-A Player
Join Date: Nov 2004
Location: Notre Dame, IN
Posts: 82
|
AppleScript to toggle audio
Hi there,
Here's a script a colleague wrote to toggle audio between devices. Perhaps this will help? <his e-mail to me allowing me to post his code> I dont have an account at the forums and probably wouldnt post much in the future. if you want to post this code, feel free to do so. Code:
--This script toggles between two audio outputs in the "Sound" pane in "System Preferences.
--USES GUI SCRIPTING - "ENABLE ASSISTIVE DEVICES" OPTION MUST BE CHECKED IN "UNIVERSAL ACCESS" PREFERENCE PANE
tell application "System Preferences"
activate
set current pane to pane "com.apple.preference.sound"
end tell
tell application "System Events"
tell application process "System Preferences"
tell tab group 1 of window "Sound"
click radio button "Output"
if (selected of row 3 of table 1 of scroll area 1) then
set selected of row 1 of table 1 of scroll area 1 to true
set deviceselected to "Headphones"
else
set selected of row 3 of table 1 of scroll area 1 to true
set deviceselected to "Speakers"
end if
end tell
end tell
end tell
tell application "System Preferences" to quit
tell me to activate
display dialog "Audio output set to " & deviceselected buttons {"Cool"} default button 1
David Klawiter Center for Creative Computing </his e-mail to me allowing me to post his code> |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|