Stuck converting an Omnifocus Taskpaper Drafts script to work with Things 3

Hi Automator gang,

Iā€™m having a bit of difficulty converting a draft script I used to use to parse through my meeting notes and convert any task that is shown in drafts as a markdown task into an Omnifocus task. I have now switched to Things3 and am not sure how to automate this. I use javascript as a drafts action as shown in the screenshot.

Does anyone have any tips for how I might be able to achieve this?

Thanks in advance :blush:

The kind of document id like to parse looks a little bit something like this:

Meeting Notes

Tasks

  • [] Task 1

Etc.

This is the code Iā€™m currently using:

// https://docs.getdrafts.com/docs/actions/scripting

let taskpaper = '';
draft.content.split("\n").forEach(function(line){
	if (line.startsWith('- [ ]')) {
		taskpaper += "Meeting Task: " + line.replace('[ ]', '') + " @tags(Meeting Action šŸŽ™)\n";
	}
});

const baseURL = "omnifocus://x-callback-url/paste";
let cb = CallbackURL.create();
cb.baseURL = baseURL;
cb.addParameter("content", taskpaper.trim());
cb.open(); ```

Answered in the Drafts forums.

1 Like