Script zum ändern des Audioausgabe Geräts

T

tfw

Mitglied
Thread Starter
Dabei seit
22.10.2005
Beiträge
55
Reaktionspunkte
1
Ich möchte ein kleines Script schreiben, das ich in iTunes integrieren kann um das Audioausgabe Gerät zu ändern.

Ich habe nämlich ein iBook und eine USB Soundkarte die an meine Steroanlage angeschlossen ist und ich will nicht dauernd die Systemsteuerung zum ändern öffnen.
Weiß jemand wie das geht?
 
...

Hallo tfw,

schau dir mal Sound Source an.

Gruß Andi
 
danke.
ist zwar nicht ganz das was ich gesucht habe.

aber vllt. weiß ja hier noch jmd. wie das mit nem script geht :)
 
...

Hallo tfw,

OK - Ein Beispiel welches das Output Device auf "Line-Out" stellen sollte. Ich kanns nicht genau testen, da ich nur über "Line-Out" verfüge :rolleyes:

Code:
tell application "System Preferences" to activate
tell application "System Events"
	tell process "System Preferences"
		click menu item "Ton" of menu "Einstellungen" of menu bar 1
		delay 2
		set devices to every row of table 1 of scroll area 1 of ¬
			tab group 1 of window "Ton"
		set the_devices to {} as list
		repeat with a_device in devices
			if (value of text field 1 of a_device as text) ¬
				is equal to "[COLOR=Red]Line-Out[/COLOR]" then
				set selected of a_device to true
				exit repeat
			end if
		end repeat
	end tell
end tell
tell application "System Preferences" to quit

Das Skript verwendet UI-Scripting. Du musst also in Systemeinstellungen->Bedienungshilfen den Zugriff für Hilfsgeräte aktivieren. Du musst an der rot markierten Stelle den Namen deines USB Geräts eintragen, wie er in der Liste in Systemeinstellungen->Ton->Ausgabe aufgeführt ist.

Gruß Andi
 
Hallo,

suche mal bei versiontracker.com nach detour - ist ein programm mit dem man für einzelne Programme (z.B. itunes/skype..) die Soundeingabe/soundausgabe bestimmen kann.

Also z.B. Itunes auf Line, Skype auf bluetoothheadset oder was sonst noch im System angemeldet ist.

Gruß
hack_meck
 
@Andi

Danke! :) Funktioniert Super! :)
Echt genial! :)
 
So habe jetzt noch ne DialogBox hinzugefügt.
Hier ist der code den ich nun benutze.


HTML:
display dialog "Sounddevice" buttons {"Anlage", "Lautsprecher", "Abbrechen"} default button 2 with icon 2
if button returned of result is "Anlage" then
	tell application "System Preferences" to activate
	tell application "System Events"
		tell process "System Preferences"
			click menu item "Ton" of menu "Einstellungen" of menu bar 1
			delay 2
			set devices to every row of table 1 of scroll area 1 of ¬
				tab group 1 of window "Ton"
			set the_devices to {} as list
			repeat with a_device in devices
				if (value of text field 1 of a_device as text) ¬
					is equal to "MD-PORT AN1" then
					set selected of a_device to true
					exit repeat
				end if
			end repeat
		end tell
	end tell
	tell application "System Preferences" to quit
else if button returned of result is "Lautsprecher" then
	tell application "System Preferences" to activate
	tell application "System Events"
		tell process "System Preferences"
			click menu item "Ton" of menu "Einstellungen" of menu bar 1
			delay 2
			set devices to every row of table 1 of scroll area 1 of ¬
				tab group 1 of window "Ton"
			set the_devices to {} as list
			repeat with a_device in devices
				if (value of text field 1 of a_device as text) ¬
					is equal to "Interne Lautsprecher" then
					set selected of a_device to true
					exit repeat
				end if
			end repeat
		end tell
	end tell
	tell application "System Preferences" to quit
end if

Noch besser wäre es natürlich wenn es ohne UI-Scripting ginge ;)
Ist aber auch so schon sehr hilfreich.
 
Zurück
Oben Unten