我目前正在使用此( http://lifehacker.com/193778/download-of-the-day-- auto+applescript-tickler-file )对于tickler文件系统,并将其设置在我的Dropbox中(因此可以跨系统工作)。使它变得完美,只有几件事。如果有人能帮助我,那将是一流的。

我所追求的是脚本或工作流程,它将在前一天使用文件夹内容(它们每天更改并编号),然后将其移至当天。因此,我可以将其设置为每天早上表演的警报。

非常感谢。

有帮助吗?

解决方案

如果我正确理解您的要求,那么此脚本应该做您想做的事情。确保将第一行的用户名更改为您的用户名。

set username to "lizzan"

set cy to (year of (current date)) as integer
set cm to (month of (current date)) as integer
set cd to (day of (current date)) as integer

set yd to yesterday(cy, cm, cd)

set yy to item 1 of yd
set ym to item 2 of yd
set yd to item 3 of yd


set yFolder to "Macintosh HD:Users:" & username & ":Documents:To Do:" & yy & ":" & ym & ":" & yd
set cFolder to "Macintosh HD:Users:" & username & ":Documents:To Do:" & cy & ":" & cm & ":" & cd

tell application "Finder"
    move every file of folder yFolder to cFolder
end tell

on yesterday(y, m, d)
    set d to d - 1

    if d ≤ 0 then
        set m to m - 1
        if m ≤ 0 then
            set y to y - 1
            set m to 12
        end if
        set thirtyones to {1, 3, 5, 7, 8, 10, 12}
        set thirties to {4, 6, 9, 11}
        if m is in thirtyones then
            set d to 31
        else if m is in thirties then
            set d to 30
        else if leapyear(y) then
            set d to 29
        else
            set d to 28
        end if

    end if

    set yd to {y, m, d}
    return yd

end yesterday

on leapyear(y)
    if y mod 4 is 0 then
        if y mod 100 is 0 then
            if y mod 400 is 0 then
                return true
            end if
            return false
        end if
        return true
    end if

    return false

end leapyear

警告:如果已经在移动到的文件夹中的文件中已经有一个具有相同名称的文件,则脚本将失败(并且可能仅移动您的某些文件)。如果要在这种情况下替换文件,避免失败,请添加 with replacing 在第18行的尽头(move every ... to cFolder with replacing).

编辑要添加: 哦,只是看到您将其设置在Dropbox中,而不是在Documents文件夹中进行设置。只需更改第14行和15行上的路径即可反映您使用的路径,就可以了。

其他提示

一个非常简单的解决方案是 Automator应用程序 (独立运行的工作流)。花了大约15秒(从字面上)设置此工作流程:alt text

许可以下: CC-BY-SA归因
不隶属于 apple.stackexchange
scroll top