Hi, I found some code on the web to process files in a subfolder.
The subfolder code is working but Applescript is throwing up an error once it detects a file to process.
I believe it is something to do with the variable “thisFile”, maybe I need to just send iFlicks the filename, not the file.
Any idea?
Thanks.
Phil
Here is the code.
set topLevel to (choose folder with prompt "Select folder to process")
splitFoldersFromFiles(topLevel)
on splitFoldersFromFiles(inputFolder)
tell application "Finder"
my processFiles(get files of inputFolder)
set FolderList to folders of inputFolder
repeat with thisFolder in FolderList
my splitFoldersFromFiles(thisFolder)
end repeat
end tell
end splitFoldersFromFiles
on processFiles(FileList)
repeat with thisFile in FileList
tell application "Finder" to set theSuffix to name extension of thisFile
if theSuffix is in {"avi", "mkv"} then
tell application "iFlicks"
import thisFile with gui
end tell
end if
end repeat
end processFiles
The code that does work but doesn’t allow for folders is this.
on adding folder items to thisFolder after receiving addedItems
repeat with anItem in addedItems
try
tell application "Finder" to set theSuffix to name extension of anItem
-- display dialog theSuffix
if theSuffix is in {"avi", "mkv"} then
tell application "iFlicks"
import anItem with gui
end tell
end if
on error e
display dialog e
end try
end repeat
end adding folder items to