Applescript to automatically copy a video into one of two folders
Hi, on my hard drive I have 2 partitions, one for my OS 10.10.2 and one for my files. On my files drive I have 2 folders to which I want to copy video to: "Movies" and "Kids Movies". I have set a "Folder Action" on mounting of my USB drive to run this applescript I have below. It automatically copies video to my "Movies" folder and then after completing the copy, ask if I want to "Eject" the usb drive via a Yes or No dialog box.
My question is, what is the script to add another dialog box before copying that asks is this a "Kids Movie". With a "Yes" answer, the movie would copy to the "Kids Movie" folder, if the "No" button is pressed it would copy the video to the "Movies" folder. Any help with this script would be greatly appreciated.
My applescript so far:
property ignoredVolumes : {"10.10 30 of 1.5T", "Files 1.5T"} -- add as needed
property videoExtensions : {"avi", "mov", "mpg", "mp4", "wmv", "mkv"}
set moviemacVolume to alias (POSIX file "/Volumes/Files 1.5T/movies")
tell application "System Events"
set rootVolumes to disk item (POSIX file "/Volumes" as text)
set allVolumes to name of every disk item of rootVolumes
set numofallVolumes to count of allVolumes
repeat with thisVolume in allVolumes
tell application "Finder"
if (thisVolume is not in the ignoredVolumes and (thisVolume as text) is not ".DS_Store") then
try
if exists alias (POSIX file ("/Volumes/" & thisVolume) as text) then set trk to 1
on error
set trk to 0
end try
if trk = 1 then
duplicate (items whose name extension is in the videoExtensions) in alias (POSIX file ("/Volumes/" & thisVolume) as text) to moviemacVolume
tell application "Finder"
display dialog "Would you like to eject USB Drive?" buttons {"yes", "no"} default button 1 with title "Eject?" giving up after 60
if button returned of result is "yes" then eject thisVolume
end tell
end if
end if
end tell
end repeat
end tell
Mac mini, OS X Mavericks (10.9.5)