iPhoto & Video export

I wrote a script which automates the export of my albums. Unfortunatly it can’t export videos included in the albums. Instead it exports a thumbnail image of the video. That’s quite annoying. How can I decide wether I have a video or a picture. Until now I haven’t found anything in the iPhoto funcitons documentation.

tell application "Finder"
	set dest_path to (choose folder) as string
	set dest_path_shell_style to POSIX path of dest_path
end tell

tell application "iPhoto"
	activate
end tell

tell application "iPhoto"
	
	repeat with album_index from 4 to (count of albums) - 1
		-- repeat with album_index from 6 to 6
		
		set my_photos to photos of item album_index of albums
		
		repeat with photo_index from 1 to (count of my_photos)
			set filepath to image path of item photo_index of my_photos
			set album_name to name of item album_index of albums
			
			tell application "Finder"
				set pic_dest_path to dest_path_shell_style & album_name
				set pic_dest_path to findAndReplace(" ", "\\ ", pic_dest_path) of me
				
				if not (exists folder (dest_path & album_name as string)) then
					do shell script "mkdir " & pic_dest_path
				end if
				

				set filepath to findAndReplace(" ", "\\ ", filepath) of me
				do shell script "cp " & filepath & " " & pic_dest_path

			end tell
			
		end repeat
	end repeat
end tell

tell application "iPhoto"
	quit
end tell

on findAndReplace(tofind, toreplace, TheString)
	set ditd to text item delimiters
	set res to missing value
	set text item delimiters to tofind
	repeat with tis in text items of TheString
		if res is missing value then
			set res to tis
		else
			set res to res & toreplace & tis
		end if
	end repeat
	set text item delimiters to ditd
	return res
end findAndReplace

I tried the modification but I get an error:

Actually the foto has no keywords.

This error should occur in

if name of keywords of photo_index contains "Movie" then

Yeah your script really works fine. Thanks a lot.