re-setting the MIDI settings with Applescript

Claire Bradin Siskin cbsiskin+ at pitt.edu
Fri Oct 27 14:43:53 EDT 2006


Here is the Applescript that we are using:

-------------------------------

on setPopUpXToY(x, y)
	tell application "System Events"
		tell application process "Audio MIDI Setup"
			tell window "Audio MIDI Setup"
				tell tab group 1
					delay 0.3
					tell pop up button x
						click
						click menu item y of menu 1
					end tell
				end tell
			end tell
		end tell
	end tell
end setPopUpXToY

try
	tell application "Audio MIDI Setup" to activate

	setPopUpXToY(8, "iMic USB audio system") -- make sure we're 
setting the properties for the iMic
	setPopUpXToY(1, "2ch-16bit") -- set the audio output format
	setPopUpXToY(5, "iMic USB audio system") -- set the Default Output
	setPopUpXToY(6, "iMic USB audio system") -- set the System Output
	setPopUpXToY(7, "iMic USB audio system") -- set the Default Input

	setPopUpXToY(9, "2ch-16bit") -- set the audio input format

	tell application "Audio MIDI Setup" to quit
end try

-------------------------------

The following procedure should work:

1. put the above script in a hidden field called "applescriptField"
2. use the following handler: do field "applescriptField" as AppleScript

Many thanks to Devin Asay for telling me how to do this!

-- 
Claire Bradin Siskin
Robert Henderson Language Media Center
University of Pittsburgh
Email: cbsiskin at pitt.edu



More information about the use-livecode mailing list