用户在Finder中打开某个文件夹时的通知


0

我真的需要一种方法来找出Finder正在查看的窗口,例如,如果用户打开某个文件夹,我可以收到通知。这可能吗?


1
@Mateusz我已经编辑了特定于此的问题,感谢您的意见。Leon,您可以随意编辑您的问题,以解决您遇到的问题,并查看标题中所述原始问题的链接副本。
grg

Answers:


1

使用内容创建AppleScript文件

on opening folder theAttachedFolder

    do shell script "echo 'The folder \"folder name\" has been opened' | mail -s 'folder opened' 'name@sld.tld'"

end opening folder

替换文件夹名称中的\“文件夹名称\”与真正的文件夹名称,在.scpt文件中输入正确的电子邮件地址,并将其保存到/图书馆/脚本/文件夹\行动\ Scripts中。

然后通过将此脚本附加到受监视文件夹来配置文件夹操作。如果mail ...在您的环境中不起作用,则必须使用另一个CLI邮件客户端。使用有效的OS X / macOS服务器及其配置和运行的邮件服务器以及相应的用户帐户,它可以直接使用。


更高级版本,只需要插入电子邮件地址:

on opening folder theAttachedFolder

    set theFolder to quoted form of POSIX path of theAttachedFolder
    set Username to quoted form of short user name of (system info)

    do shell script "echo 'The folder " & theFolder & " has been opened by " & Username & "!' | mail -s 'Monitored folder opened' 'name@sld.tld'"

end opening folder
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.