0

Usually i quickly update my TODO list creating a new empty file named like this:

2013-10-01 Tell a friend that stackoverflow rocks
2013-10-23 Prepare my super meeting about coding

and so on..

i just need a workflow or applescript that take all file in the folder, extract the date and the title from the file name and creates a new iCal event on that day with that title!

it seems so easy, but how can i achieve that?

4

2 に答える 2

1

これはまっすぐな Applescript です。

注:日付形式をDD-MM-YYYYに変更するかどうかによって異なります(組み込みの日付パーサーのApplescriptによる)

tell application "Finder"
    set data_folder to folder POSIX file "/Users/me/Desktop/my_ical_data"
    set all_items to every item of data_folder
end tell

set my text item delimiters to {" "}

repeat with cur_item in all_items
    set nm to the name of cur_item
    set event_date to date (text item 1 of nm)
    set event_desc to (text items 2 thru -1 of nm) as string
    tell application "iCal"
        tell calendar "Work" -- name of calendar you wish to add to
            make new event with properties {summary:event_desc, start date:event_date, description:""}
        end tell
    end tell
end repeat
于 2013-10-01T22:16:28.183 に答える
0

システム環境設定で日付形式を変更する必要はありません。

tell application "Finder" to name of items of folder POSIX file "/Users/username/todo"
repeat with l in result
    set s to text ((offset of space in l) + 1) thru -1 of l
    set d to current date
    tell d to set {year, month, date, time} to {text 1 thru 4 of s, text 6 thru 7 of s, text 9 thru 10 of s, 0}
    tell application "iCal" to tell calendar "Work"
        make new event with properties {summary:s, start date:d}
    end tell
end repeat
于 2013-10-02T05:11:01.360 に答える