Poor Man's Kiosk Software Using AppleScript

Hi,

as stated in the title, I'm trying to create a simple Kiosk like presentation using AppleScript. I'm alread able to alternate between a photo show and and a web site. Now I want to add some movie clips to the mix.

This is what I have so far:
Code:
tell application "QuickTime Player"
	activate
	
	tell application "Finder"
		set clipfolder to "/Users/Shared/Kiosk/Clips/"
		set filelist to list folder clipfolder
	end tell
	
	repeat with clip in filelist
		set fullpathclip to clipfolder & clip
		open fullpathclip
		present document 1
		play document 1
		-- wait until movie is done
		repeat until (get done of document 1)
		end repeat
		close document 1
	end repeat
end tell

Whatever the number and length of movies inside the clips folder, I want to show them all automatically, and then get back to the photos or web site. But I'm unable to get the "wait until movie is done" part working. I found that snippet on the Internet but AppleScript doesn't recognise the done argument. If I remove those 2 lines alltogether, AppleScript just rushes through the files without displaying any clips. I could use the delay command, but then I'd have to recalculate the delay time every time I make any change to the movie clips.

Thanks for any pointers.
 

quarlie

Ars Scholae Palatinae
1,359
Now that I've had a chance to test the script, I see the same behavior. A 1-second delay fixed it for me, though there may be a better solution that I don't know about. (I'm just a dabbler when it comes to AppleScript.)
Code:
tell application "QuickTime Player"
	activate
	
	tell application "Finder"
		set clipfolder to "/Users/Shared/Kiosk/Clips/"
		set filelist to list folder clipfolder
	end tell
	
	repeat with clip in filelist
		set fullpathclip to clipfolder & clip
		open fullpathclip
		present document 1
		play document 1
		-- wait until movie is done
		repeat until not (get playing of document 1)
		end repeat
		close document 1
		delay 1
	end repeat
end tell