我是Apple的新手,但我想设置一个文件夹操作:
1. Recognises when a file is added to a folder
2. Tags said folder red
3. Adds a Reminder to the "Downloads" reminder list that has the name of the newly-added file as the body text of the reminder
使用google和Applescript的记录功能到目前为止,我已经将这个记录在一起
property dialog_timeout : 30 -- set the amount of time before dialogs auto-answer.
on adding folder items to this_folder after receiving added_items
try
tell application "Finder"
set FILEname to name of (added_items)
set label index of folder "untitled folder" of folder "Desktop" of folder "heyjeremyoates" of folder "Users" of startup disk to 2
end tell
tell application "Reminders"
set mylist to list "Downloads"
tell mylist
make new reminder with properties {name:"D/L Complete", body:FILEname, due date:(current date)}
end tell
end tell
end try
end adding folder items to
Darn的东西不起作用。真气。我测试它作为文件夹操作,“test”作为提醒的名称和正文,它工作正常。我很确定我在设置FILEname作为新复制项目的名称时出错了,因为现在的脚本不再将文件夹变为红色。
这背后的想法是这样,我可以从我的iPhone / iPad上看到有多少大量/预定下载到我的家用mac(包括种子和大型工作文件 - 我将为每个文件分别提供一个文件夹操作和提醒列表下载文件夹)还有待管理。
如果iCloud / Reminders和十几行代码可以提供我想要的东西,似乎设置一个Growl / Prowl组合是浪费的。理想情况下,当我重命名或移动相关文件时,我会写第二个AppleScript将删除提醒,虽然我甚至没有想过如果有人对此有任何建议会如何工作我会非常感激
遗憾的是,您不能(本机地)将OSX通知推送到链接到同一iCloud帐户的iOS设备(具有适当的粒度)
但是我离题了 - 谁能看到我搞砸了什么?
提前感谢您阅读此内容
答案 0 :(得分:1)
added_items
是别名列表,name of (added_items)
导致错误。
on adding folder items to this_folder after receiving added_items
tell application "Finder"
set label index of this_folder to 2
repeat with f in added_items
set n to name of f
tell application "Reminders" to tell list "Downloads"
make new reminder with properties {name:"D/L Complete", body:n, due date:(current date)}
end tell
end repeat
end tell
end adding folder items to
(将脚本保存在~/Library/Workflows/Applications/Folder Actions/
中,并从“文件夹操作设置”中启用文件夹操作。)