Pierre,
As you seem the guy to speak to in regards to Apple script, do you have any idea why the second part of this script does not work? The goal of the script is to be able to switch between 2 different input/output , one being the Internal and the other being an USB headset.
The non working part is after --USB
Any help would be greatly appreciated
Merci d'avance
property cancel : "Cancel"
tell application "System Preferences" to activate
activate --making dialogue box frontmost
set answer to button returned of (display dialog "
Select Sound Input / Output
" with icon file ((path to me) & "Contents:Resources:icn:SoundPrefcopy.icns" as string) with title "Select Sound Input/Output " buttons {"iMac", "USB", "Cancel"} default button 2)
-- Internal
if answer is equal to "iMac" then
tell application "System Preferences"
reveal anchor "input" of pane id "com.apple.preference.sound"
tell application "System Events" to tell process "System Preferences"
tell table 1 of scroll area 1 of tab group 1 of window 1
select (row 1 where value of text field 1 is "Internal microphone")
end tell
end tell
end tell
tell application "System Preferences"
reveal anchor "output" of pane id "com.apple.preference.sound"
tell application "System Events" to tell process "System Preferences"
tell table 1 of scroll area 1 of tab group 1 of window 1
select (row 1 where value of text field 1 is "Internal speakers")
end tell
end tell
end tell
-- USB (Non working)
if answer is equal to "USB" then
tell application "System Preferences"
reveal anchor "input" of pane id "com.apple.preference.sound"
tell application "System Events" to tell process "System Preferences"
tell table 1 of scroll area 1 of tab group 1 of window 1
select (row 2 where value of text field 1 is "Microsoft LifeChat LX-3000")
end tell
end tell
end tell
tell application "System Preferences"
reveal anchor "output" of pane id "com.apple.preference.sound"
tell application "System Events" to tell process "System Preferences"
tell table 1 of scroll area 1 of tab group 1 of window 1
select (row 2 where value of text field 1 is "Microsoft LifeChat LX-3000")
end tell
end tell
end tell
--Cancel
if answer is equal to "Cancel" then
cancel
end if
end if
end if
tell application "System Preferences" to quit