Drafts to Taskpaper

Hi

I´m trying to get this script to work

https://actions.getdrafts.com/a/14c

Has anybody gotten this to work ?

I always get this Error
“Script Error: Error: File /Users/-K-/Dropbox (Personal)/Support Files/.taskpaper doesn’t seem to be expected Taskpaper format
Line number: 75, Column 18”

Did you edit the script? The notes in the action say you need to configure the path for the file you want to use. See this line in the script:

// Set local varible to the Dropbox folder/filename where TaskPaper document is stored
let filePathAndName = "/Taskpaper/<REPLACE WITH FILENAME>.taskpaper"

Thank you for you´re quick response.

Yes I did.

It seems to stop working at line 75, column 18

  • I think it´s checking if the first heading/project in the file is named “Inbox:”
  • And I have it like that

I don´t understand it

Here´s a print screen of the code where it stops

< and > are redirection instructions on the command line. They can’t be part of a filename and we’re used I. The example just to highlight the section to be replaced - i.e. inclusively.

Delete them from your defined file path and try again.

1 Like

I tried that, still get the same error, but if thats the problem isnt it wierd that the error comes in line 75

Line 75 is the error handling that kicks in and is related to the file, setting it is just working with strings where it has no concept of it being a path at that point, but you did post it just prior, and that’s what I was replying to/highlighting.

I’ve just downloaded the action to try it myself, and it seemed to work fine. Here’s a worked example.

I created a Taskpaper file at the following Dropbox location:

/Inspiration & Perspiration/_Taskpaper/test.taskpaper

*I already had several Taskpaper files in there, so it seemed a natural choice within my own file structure on Dropbox, and gave me access with the app I use on i`OS for Taskpaper files.

I set the contents of the Taskpaper file to the following, inline with what the action seemed to be, somewhat arbitrarily, indicating. I also included one example task under the specified inbox project to check it interacted with it correctly.

Inbox:
	- This is the first task

I made one change to the script to set the file location This was made on line 18.

// Set local varible to the Dropbox folder/filename where TaskPaper document is stored
let filePathAndName = "/Inspiration & Perspiration/_Taskpaper/test.taskpaper"

I then created a draft with the following content.

one
two
three

Next, I ran the action on the draft. This updated the specified Taskpaper file to be as follows:

Inbox:
	- one
	- two
	- three
	- This is the first task

The resulting log file entry in Drafts looked like this:

See if this worked example helps you get any further. If not, pleas provide details of your draft, a copy of your action (you can share it unlisted), a sanitised version of your destination Taskpaper file (i.e. keep personal tasks you may have in it personal and test it with dummy content you can share), and confirm the path to the destination Taskpaper file.

Hope that helps.

1 Like

Awsome! thanks it works now

My pathname url was to long
it was = /Users/-K-/Dropbox (Personal)/Support Files/Inbox.taskpaper
I changed it to = /Support Files/Inbox.taskpaper

And now it works.

Sylumer, thank you for you´re help :slight_smile:

But one more thing, are you able to send multiple drafts ? That does not work in my case, I guess i could just merge them before I send them as a workaround.

If you look at the code, you can see the author scripted it around the editor object rather than the draft object. As a result if you try to use the draft for batch processing, it would simply try to use the loaded draft each time rather than each of the selected set of drafts.

But there’s a simple fix. Just change,

	let newTaskText = editor.getText()

to

	let newTaskText = draft.content

That gets it processing the content of the draft rather than the editor, and then it works for batch processing.

1 Like

Thank you again I will try that for batching.

I don´t know what happened, but when I got the script to work all of a sudden my task manager “Omnifocus” stopped working… does that make any sense to you ?

I have sent the omnifocus group a mail about this.

I tried the batch edit you recomended but it didn´t work

I´m wondering, is there any way you could change the script quickly and make it

For each draft
First line = task
Second line = note

And being able to select multiple drafts and send them all.

I mean if it´s easy for you.

I also posted in the “Taskpaper forum” and the script creator just answered me, for anyone who might be interested in this

Odd. It works for me. What shows in the loga for you?

I could, but what if you tried modifying it yourself and we were all here to help you along the way if you got stuck?

I might suggest that at this point you think about what you have and what you are doing.

  • Will each draft always have two lines?
  • If each draft could always have more than two and optional notes, could you actually just use taskpaper syntax and then (almost) just prepend it to the inbox file?
  • Do you always need this saved to a file in Dropbox under a project called Inbox?