Importing Plain Text into Mountain Lion Reminders App

I have created a new project to enrich the tags in my WordPress blog using the WP Calais Auto Tagger that I mentioned in this previous blog post. To do this I am working on pages of old posts in my WordPress dashboard and so I wanted to track just which pages I had completed and which ones still need my attention. I’ve got 48 pages of blog posts and so this is going to take some time to complete.

The first step was to create a list of text lines going from Page 48 to Page 1 like a countdown. I did that in OpenOffice using the Spreadsheet app. All you need to do here is type in two lines where the number series example can be made and then you can select these two cells and then grab the autonumbering control on the spreadsheet and draw it down, this is a great way to quickly create very repetitive lines where the only thing that changes is a number at the end. With this list, I copied it into a plain text file with each line on it’s own and saved it as “tagging.txt” on my desktop.

The next step is to use AppleScript to tell the Mountain Lion Reminders app to create entires automatically based on the file you just made in OpenOffice. Technically the Reminders app has an import mechanism but that’s only meant for ICS files, and that’s more trouble than it’s worth as far as I care to pursue it as a solution. Here’s the AppleScript:

 

set theFileContents to read file "Users:andy:Desktop:tagging.txt"
set theLines to paragraphs of theFileContents

repeat with eachLine in theLines
tell application "Reminders"
tell list "Tagging Project"
make new reminder with properties {name:eachLine}
end tell
end tell
end repeat

The only part you’d have to fix is the file location part and the list name part. Otherwise it works well. The only gotcha is it doesn’t seem to import the tasks in order, but at least they are in there.

Here are some helpful sites where I got a lot of this code and hints on how to talk to Reminders instead of iCal:

Benguild.com Page

MacScripter Page