Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I am currently using this ( http://lifehacker.com/193778/download-of-the-day--auto+applescript-tickler-file ) for a tickler file system and have it setup in my Dropbox (so it works across systems). There are just a couple of things from making it perfect. If anyone can help me out that would be superb.

What I'm after is a script or workflow that will take the folders contents for the previous day (they change each day and are numbered) and move them to the current day. So then I can set it in as an alarm to perform in the morning every day.

Thanks very much.

share|improve this question
add comment

2 Answers

up vote 2 down vote accepted

If I understand your requirements correctly, then this script should do what you want. Make sure to change the username on the first line to your username.

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

Caveat: The script will fail (and have moved possibly only some of your files) if there is already a file with the same name in the folder it is moving to. If you want to replace the files in that case, and avoid failing, add with replacing at the end of line 18 (move every ... to cFolder with replacing).

Edit to add: Oh, just saw that you had it set up in your Dropbox instead of in the Documents folder. Just change the paths on lines 14 and 15 to reflect the path you're using, and it should be fine.

share|improve this answer
    
Superb! It worked! I needed to make a couple of changes, but yes! You are superb - Thank you!!! Yeah I changed the location to the Dropbox and I also changed Macintosh HD to Main HD and it was all good. –  Sulcalibur Nov 12 '10 at 10:14
    
@Sulcalibur Thanks, it was my pleasure to help - wouldn't have done it if I didn't think it would be fun...=) –  Lizzan Nov 12 '10 at 17:28
add comment

A very simple solution is an Automator Application (workflow that runs independently). Took about 15 seconds (literally) to set this workflow up: alt text

share|improve this answer
    
While certainly useful in its own right, I don't think this does what the OP wanted it to do. This workflow will move files created in the last day, but from what I understand of the tickler file system you place files in folders for the day you're supposed to deal with them. If not dealt with on that day, they should be moved to the current day to prevent them being forgotten. So, the files to move could have been created at any time, really. –  Lizzan Nov 13 '10 at 10:33
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.