【问题标题】:folder action not triggered after macos catalina updatemacOS Catalina 更新后未触发文件夹操作
【发布时间】:2023-05-03 18:04:02
【问题描述】:

当文件被添加到文件夹时,我有一个文件夹操作,以添加多个标签。
自从 Catalina 更新以来,这失败了...
在 automator 中,如果我使用“get finder items”进行测试,我可以让它工作。

当我将文件添加到文件夹本身时,没有任何反应。

隐私和安全设置

  • automator拥有完整的磁盘访问权限
  • FolderActionsDispatcher.app 有权访问
    • 我的网络容量
    • 自动化中它可以访问finder
property ca : current application
property tagname : {"tag_1", "tag_2", "tag_3", "tag_4", "tag_5"}

use framework "foundation"
use AppleScript version "2.4" -- Yosemite 10.10 or later required
use scripting additions

on run {input, parameters}
    repeat with anItem in input
        set_tag(anItem, tagname)
    end repeat
    return input
end run

on set_tag(theFile, atag)
    set tagArray to ca's NSArray's arrayWithArray:atag
    set fileURL to ca's |NSURL|'s fileURLWithPath:(POSIX path of theFile)
    fileURL's setResourceValue:tagArray forKey:(ca's NSURLTagNamesKey) |error|:(missing value)
end set_tag

上网查了一下,没有找到答案。所以我希望这里有人可以帮助我。

工作流程的打印屏幕

【问题讨论】:

  • 你向这个 AppleScript 动作传递了什么?我假设是一组文件?您可以尝试set_tag(get anItem, tagname)set_tag(contents of anItem, tagname),这应该会强制处理程序调用按值传递而不是按引用传递。
  • 另外,仅供参考,您已将 tagname 定义为全局属性,因此您无需在处理程序调用中传递它。处理程序已经可以看到全局属性。
  • 感谢您的反馈,@TedWrigley 不幸的是,这些建议都不能解决问题当我让它再次工作时,就像在卡特琳娜之前一样,我会考虑将变量更改为本地或否再通过吧。但我不会一次进行 2 项更改,这会使故障排除变得更加困难 :) 回答您的问题:1 个或多个文件
  • 在自动机中,它可以工作;我添加了“获取查找器项目”操作。所以问题不在于脚本,而是在将文件添加到文件夹时不再触发脚本。
  • 你能展示你正在使用的自动化工作流程吗?

标签: macos-catalina finder


【解决方案1】:

尝试退出活动监视器中的“folderActionsDispatcher”进程。当我的文件夹操作没有触发时,通常是因为此进程由于某种原因没有触发。

【讨论】:

    最近更新 更多