I have a Folder Action watching a folder to run an Applescript whenever a file is added to it.
The Applescript tells my thumbnail generator app to process the images. This works fine.
The issue is that I’m telling the thumbnail generator to put the processed images into a subfolder of the original folder. When this happens, the Folder Action gets triggered again, and it makes a thumbnail of the thumbnails in yet another subfolder.
This happens only once for some reason, but its still too much.
Is there a way I can set a Folder Action to ignore files added to its subfolders? I need to maintain this directory structure where the thumbnail generator outputs into a child folder.
Here’s the script just incase:
on adding folder items to this_folder after receiving added_items
repeat with eachItem in added_items
tell application "ThumbsUp" to open eachItem
end repeat
end adding folder items to
Hi. The expected functionality is that adding contents triggers the mechanism. Use the watched folder to move the dropped items to a processing/processed folder.
Simply make your action be ignored for each added item, whose parent folder is not this_folder:
on adding folder items to this_folder after receiving added_items
repeat with eachItem in added_items
tell application "Finder" to set itsParent to (container of eachItem) as alias
if itsParent is this_folder then tell application "ThumbsUp" to open eachItem
end repeat
end adding folder items to
I installed ThumbsUp to see how it works. As I understand it, the problem is created by the application adding a subfolder to the hot folder. This can be fixed by ignoring the action for any added subfolders:
on adding folder items to this_folder after receiving added_items
repeat with eachItem in added_items
tell application "System Events" to set itsKind to kind of eachItem
if not (itsKind is "Folder") then tell application "ThumbsUp" to open eachItem
end repeat
end adding folder items to