djrbx Posted October 20, 2009 Share Posted October 20, 2009 I written a small applescript droplet which would allow a user to drop quicktime movie files with mutiple audio channels assignments and the script would then change all those assignments into their given field. Left, Right, Center, Etc. Does anyone know a way to compress the code so it would not be so redundant in calling the same function over and over? Thanks ------------------------------------------------------------------------------------------------- -- -- -- v0.7.5-1 -- -- Changes the value of audio channel settings (L,R,C, etc.) within movie files -- -- -- ------------------------------------------------------------------------------------------------- display dialog "Please drop QuickTime Movies onto script to run. Thanks! :-P" on open myFileList -- Allows script to be used in either Leopard or Snow Leopard -- Sets the name of appID "com.apple.quicktime" --> qtPlayer tell application "Finder" set qtPlayer to name of application id "com.apple.quicktimeplayer" end tell -- Makes the target application the active window tell application id "com.apple.quicktimeplayer" activate repeat with myFile in myFileList set myMovie to (open myFile) -- Call on "System Events" for QuickTime Player 7 tell application id "com.apple.systemevents" tell process qtPlayer -- Shows Movie Properties tell menu bar 1 tell menu bar item "Window" tell menu "Window" click menu item "Show Movie Properties" activate end tell end tell end tell -- select row 3 of table 1 of scroll area 1 of window 1 click radio button 3 of tab group 1 of window 1 tell pop up button 1 of row 1 of table 1 of scroll area 1 of tab group 1 of window 1 click click menu item "Left" of menu 1 end tell -- select row 4 of table 1 of scroll area 1 of window 1 click radio button 3 of tab group 1 of window 1 tell pop up button 1 of row 1 of table 1 of scroll area 1 of tab group 1 of window 1 click click menu item "Right" of menu 1 end tell -- select row 5 of table 1 of scroll area 1 of window 1 click radio button 3 of tab group 1 of window 1 tell pop up button 1 of row 1 of table 1 of scroll area 1 of tab group 1 of window 1 click click menu item "Center" of menu 1 end tell -- select row 6 of table 1 of scroll area 1 of window 1 click radio button 3 of tab group 1 of window 1 tell pop up button 1 of row 1 of table 1 of scroll area 1 of tab group 1 of window 1 click click menu item "LFE Screen" of menu 1 end tell -- select row 7 of table 1 of scroll area 1 of window 1 click radio button 3 of tab group 1 of window 1 tell pop up button 1 of row 1 of table 1 of scroll area 1 of tab group 1 of window 1 click click menu item "Left Surround" of menu 1 end tell -- select row 8 of table 1 of scroll area 1 of window 1 click radio button 3 of tab group 1 of window 1 tell pop up button 1 of row 1 of table 1 of scroll area 1 of tab group 1 of window 1 click click menu item "Right Surround" of menu 1 end tell -- select row 9 of table 1 of scroll area 1 of window 1 click radio button 3 of tab group 1 of window 1 tell pop up button 1 of row 1 of table 1 of scroll area 1 of tab group 1 of window 1 click click menu item "Left Total" of menu 1 end tell -- select row 10 of table 1 of scroll area 1 of window 1 click radio button 3 of tab group 1 of window 1 tell pop up button 1 of row 1 of table 1 of scroll area 1 of tab group 1 of window 1 click click menu item "Right Total" of menu 1 end tell -- -- Check to make QuickTime Player active window before saving tell application id "com.apple.quicktimeplayer" activate end tell -- Saves any and all changes then closes all windows tell menu bar 1 tell menu bar item "File" tell menu "File" click menu item "Close" click menu item "Save" click menu item "Close" end tell end tell end tell end tell end tell close myMovie end repeat quit end tell end open Link to comment Share on other sites More sharing options...
A Nonny Moose Posted November 15, 2009 Share Posted November 15, 2009 You can try using a repeat command, which is described here. Link to comment Share on other sites More sharing options...
Recommended Posts