Cueing movies in a folder

Would appreciate any help.

I’m trying to cobble together a script that will scan a folder and list the movies in it; then play that list; then finish, and rescan to create a new list (for movies that are added while the list was playing). So a cueing script, I guess. I can’t figure it out from the sourcebooks I have, and I cannot find scripting additions that would help, or any snippets of script. Has anyone ever done this?

Not a little job!
Some snippets follow… ABSOLUTELY UNTESTED, but it may help you…

property movie_types : {"MooV", "MPEG", "VfW "}
global queue

on run
	set queue to {}
	set ScriptPlayer's currentSong to 0
end run

on idle
	addToQueue() -- check & add new movies to the list
	tell ScriptPlayer to beGood()
	return 1
end idle

on addToQueue() --> scan target folder
	tell app "Finder" to set y to every file of alias "HD:FolderToScan:" as alias list
	repeat with i in y
		if (i's contents) is not in contents of queue then
			if (file type of (info for i)) is in contents of movie_types then
				set end of queue to i's contents
			end if
		end if
	end repeat
end addToQueue

script ScriptPlayer
	global currentSong
	
	on beGood()
		set new_song_please to my check_if_movie_finished()
		if new_song_please then
			playNewMovie()
		end if
	end beGood
	
	to check_if_movie_finished()
		tell application "QuickTime Player"
			return done of movie 1
		end tell
	end check_if_movie_finished
	to playNewMovie()
		set currentSong to currentSong + 1
		try
			tell application "QuickTime Player"
				try
					close every movie --> last movie is finished... Close!
				end try
				open queue's item currentSong --> next alias file
				play movie 1
			end tell
		on error -- there is not more items in the queue
			set currentSong to currentSong - 1
		end try
	end playNewMovie
end script

You will need to add:
property new_song_please : “”
and
property currentSong : 0
to the script ScriptPlayer
property new_song_please : “” is done so that the beGood() handler will trap the boolean return of Quicktime. As the script is running it will return something, otherwise the script will fail, not getting any information from Quicktime.

The same thing is needed for the currentSong. Setting the property will allow the script object information that is does not get from any regular expressions until run.

JJ thanks for posting this script. I have been wanting to start learning Script Objects. This makes it pretty easy and straight forward.

Good point!

  • Smilies for my 100th post
    :smiley: :smiley: :smiley: :smiley: :smiley: :smiley: :smiley: :smiley:

Peeps, :smiley:

Thanks so much for your help.
The art exhibition this is for is starting next Friday!
I’ve already got long scripts to automate the recording, saving, naming, copying, and archiving features for people to go into a booth, record their movies, and watch them play within the next hour on a playback computer elsewhere in the gallery (which also self-monitors hard drive storage capacity and deletes/archives when its getting dangerously low). The only missing piece was a playback script, and since I"d just learned applescript, it was getting a bit over my head.
Your help is much appreciated. Thanks will be given to you in the comments of the script.
All best, amh