(* This script creates a movie out of a folder of sounds and a folder of images. The first image is displayed for the length of the first sound, the second image is displayed for the length of the second sound, etc. Note that the graphic and sound files must be in different folders, and there must be the same number of files in each folder! No type checking is done, so be sure sound folders have sounds and graphic folders have graphics! *) set filesChosen to 0 try repeat until filesChosen is not equal to 0 set audioFolder to getAudiofolder() set graphicsFolder to getGraphicsFolder() set audioPath to audioFolder as string set graphicsPath to graphicsFolder as string if (audioPath is equal to graphicsPath) then set result to (display dialog "the audio and graphic paths must be different!" buttons {"Quit", "Choose Again"} default button "Choose Again") if button returned of result is equal to "Quit" then set filesChosen to 2 else if button returned of result is equal to "Choose Again" then set filesChosen to 0 end if else set filesChosen to 1 end if end repeat on error set filesChosen to 3 end try -- -- if filesChosen is 2, then no choice was made -- if filesChosen is equal to 2 then display dialog "Quitting!" buttons {"OK"} default button "OK" return end if if filesChosen is equal to 3 then display dialog "Cancelled!" buttons {"OK"} default button "OK" return end if set graphicsList to (list folder graphicsFolder without invisibles) set soundList to (list folder audioFolder without invisibles) set graphicsCount to the number of items in graphicsList set soundCount to the number of items in soundList if graphicsCount is not equal to soundCount then display dialog "The number of sounds and graphics aren't equal! Please go back and make sure there are an equal number of graphic and sound files!" buttons {"I Will"} default button "I Will" return end if set myMovie to newmovie() repeat with i from 1 to graphicsCount set soundFile to (audioPath & item i of soundList) as string set soundItem to openFile(soundFile) set graphicsFile to (graphicsPath & item i of graphicsList) as string set graphicsItem to openFile(graphicsFile) addSoundAndGraphics(myMovie, item i of soundList, item i of graphicsList) end repeat on newmovie() tell application "QuickTime Player" make new movie set theMovie to movie 1 end tell return theMovie end newmovie on openFile(theFile) tell application "QuickTime Player" open file theFile set theItem to window 1 end tell return theItem end openFile on addSoundAndGraphics(theMovie, theSound, theGraphic) tell application "QuickTime Player" select all movie theSound copy movie theSound -- select window theMovie paste theMovie -- select window theGraphic select all movie theGraphic copy movie theGraphic -- select window theMovie add theMovie with scaled close movie theSound saving no close movie theGraphic saving no end tell end addSoundAndGraphics on getAudiofolder() set audioFolder to (choose folder with prompt "Chooose the folder containing the movie sounds") return audioFolder end getAudiofolder on getGraphicsFolder() set graphicsFolder to (choose folder with prompt "Chooose the folder containing the movie images") return graphicsFolder end getGraphicsFolder