I’m trying to make a folder action that will watch a folder i download to, label it then if the file format is a video it would convert to a mp4 then copy it to another folder. the trouble I’m having is i want to delete the original one after it is converted.
on adding folder items to this_folder after receiving these_items
set fileColorList to {oranges:{"mkv", "avi", "wmv", "mov"}, reds:{"rar", "sit", "dat", "bz2", "tbz", "hqx", "mpkg", "iso", "bin", "ppt", "dmg", "sit", "rar", "gz", "zip", "tar"}, yellows:{"torrent", "txt", "rtf", "scpt", "htm", "html", "xls", "xml", "plist", "pl"}, greens:{"mp4"}, blues:{"mp3", "m4a", "wma", "wav", "aiff"}, purples:{"gif", "png", "jpeg", "bmp", "tiff", "raw", "pgf"}, greys:{"dmg", "bin", "iso"}}
tell application "Finder"
repeat with myFile in these_items
--display dialog myFile as string
if the name extension of myFile is in oranges of fileColorList then
set label index of myFile to 1
else if the name extension of myFile is in reds of fileColorList then
set label index of myFile to 2
else if the name extension of myFile is in yellows of fileColorList then
set label index of myFile to 3
else if the name extension of myFile is in blues of fileColorList then
set label index of myFile to 4
else if the name extension of myFile is in purples of fileColorList then
set label index of myFile to 5
else if the name extension of myFile is in greens of fileColorList then
set label index of myFile to 6
else if the name extension of myFile is in greys of fileColorList then
set label index of myFile to 7
end if
end repeat
end tell
delay 30
set input_list to oranges of fileColorList
tell application "VisualHub" to set VisualHub to load script (scripts path of main bundle & "/automation.scpt" as POSIX file)
tell VisualHub
repeat while item 1 of CheckStatus() is not equal to 1
delay 30
end repeat
ClearAll()
AddFiles(input_list)
LoadSettings("Mac Home Server:Users:tomwynne:Desktop:settings.vhub")
SetSaveLocation("Media:Movies")
delay 15
end tell
end adding folder items to