【发布时间】:2020-09-27 11:40:55
【问题描述】:
我有一个文件夹操作来监视文件夹,以便在将文件添加到其中时运行 Applescript。
Applescript 告诉我的缩略图生成器应用程序来处理图像。这工作正常。该应用程序会创建一个子文件夹,并将缩略图放入其中。
问题是文件夹操作会为子文件夹中的每个图像触发,它会在另一个子文件夹中生成缩略图的缩略图。
由于某种原因,这种情况只发生了一次,但仍然太多了。
有没有办法可以设置文件夹操作来忽略添加到其子文件夹的文件?我需要维护缩略图生成器输出到子文件夹的目录结构。
这是脚本:
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
在另一个论坛上有人建议这样做:
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
这应该使 ThumbsUp 不会在子文件夹中的项目上运行,但由于某种原因它会继续以相同的行为。
如何阻止文件夹操作在子文件夹上运行?
【问题讨论】:
标签: applescript