Files
blog/content/posts/2012-12-08-import-things-tasks-into-apples-reminders.md
T
James McDonald 96eedb5095 Import
2018-01-09 20:39:32 +01:00

67 lines
2.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: Import Things tasks into Apples Reminders
author: james
type: post
date: 2012-12-08T13:36:46+00:00
url: /2012/12/import-things-tasks-into-apples-reminders/
dsq_thread_id:
- 964365161
categories:
- Apple
- Hacks
---
OK, so I was making a list of things to do today, but then I decided that having created them in Things, I wanted to move them to Apple’s Reminders. Don’t ask – I’m a task list fetishist.
A neat trick you can do with Cultured Code&#8217;s <a href="http://culturedcode.com/things/" target="_blank">Things</a> is to select a bunch of tasks and drag them to a text editor, which will create one line per task with any note appended in brackets. Looks sort of like this:
<pre class="lang:default highlight:0 decode:true " title="Things export" >- Make lists of things
- Procrastinate (Try making scripts to manage lists of things)
</pre>
This is all very well, but there&#8217;s no simple way to get that list into Reminders without copying and pasting the relevant bits individually. That sounded boring, so instead I learned enough AppleScript to do it automatically. It probably took more time, but it was definitely more amusing. Anyway, it was that or complete the bunch of tasks I&#8217;d just written down.
Here&#8217;s the AppleScript code to accomplish this feat.
<pre class="lang:applescript decode:true " title="Reminders Importer" >-- Reminders Importer
-- James McDonald &lt;james@jamesmcdonald.com&gt;
-- Imports a text file into Reminders as one task per line.
-- Creates a task list called "Import". Strips off " -" at the start and puts bracketed text into the body (note) of the task. This is the format you get by dragging from Things to a text editor.
tell application "Reminders"
if not (list "Import" exists) then
make list with properties {name:"Import"}
else
tell list "Import" to delete reminders
end if
end tell
tell application "Reminders"
repeat with l in paragraphs of (read file "Users:james:Documents:tasks.txt")
if length of l is not 0 then
if l starts with "- " then
set l to characters 3 through end of l as text
end if
if l contains "(" then
set AppleScript's text item delimiters to "("
set b to text item 2 of l
set l to text item 1 of l
set AppleScript's text item delimiters to ")"
set b to text item 1 of b
set AppleScript's text item delimiters to ""
else
set b to "" as text
end if
tell list "Import"
make reminder with properties {name:l, body:b}
end tell
end if
end repeat
end tell
</pre>
Yes, I know. AppleScript is weird.
So, now that I&#8217;ve written the blog post about the script to migrate to one task manager from another the list of tasks I made of things to do this morning, it&#8217;s this afternoon. Yay!