How to copy a task's note to new task? (AppleScript or JavaScript)


#1

Hey All.

I’ve been struggling with this a bit, and haven’t found a good solution online yet.

If the back story matters, I made a mess of my inbox and don’t want to process it all at once. So I moved all my inbox items to a project named “Old Inbox”, and I want to automatically bring a few of those tasks in to my real inbox each day.

I hit a wall trying to remove the project from a task, there doesn’t seem to be a way to do it that I can see.
I tried doing it a number of ways, but all of them ran in to errors. Including one that said “OmniFocus got an error: Replacement not supported currently, please log a feature request if you need this.”

So, I came across someone pointing out that you could just copy the task’s name and notes to a new inbox task, and remove the old one. Perfect! Except that the Note field loses it’s formatting when you do this.

I have not found a way to copy the note field and keep the formatting…

Here is a script to test this out (this fails):

tell application "OmniFocus"
	tell default document
		set interestingProject to first flattened project whose name is "Old Inbox"
		set interestingTasks to tasks of interestingProject
		set currenttask to item 1 of interestingTasks
		set newTask to make new inbox task with properties {name:currenttask's name, note:currenttask's note}
	end tell
end tell

Error: OmniFocus got an error: Wrong type for note. Should be text or rich text, “OSPropertyScriptText”

I also tried “currenttask’s note as rich text”. This also fails. The only thing that does work is to use “as text”, which removes the formatting…

Any ideas?