Getting Tasks from Drafts into OmniFocus with Specific Tag?

Hello!

I love cracking open Drafts 5 actions and tweaking them to suit my needs, but this is the first time I haven’t been able to figure it out; I don’t know JavaScript at all.

I use this Drafts action to get each line of a Draft added to my OmniFocus 3 inbox as a separate task. What I’d like to do is make a version of this that adds each line as a separate task in a specific tag. My dream is to have an Add to Grocery List action in Drafts that’ll add everything I’d written as separate tasks, each tagged with the Groceries tag.

Sadly, I can’t make heads or tails of this JavaScript. What do I need to change/add to make this action work with specific tags?

I would recommend using the Taskpaper to OmniFocus action instead (http://actions.getdrafts.com/a/1Gj) and then just have a draft with @tag(tag1, tag2) in the list

https://support.omnigroup.com/omnifocus-taskpaper-reference/

Not as automatic perhaps as you would like though?

I’m not an OmniFocus user, but I think I keep hearing that the old GTD framing of contexts was replaced by tags in the latest version.

Judging by this Inside Omnifocus URL scheme page, the URL scheme for adding tasks seems to have a parameter called context, so perhaps this could be equivalent to adding a tag?

If so you would need to do something like add a line like this:

cb.addParameter("name", line);
//New line below, existing line above
cb.addParameter("context", "my_example_tag");

Presumably quick for you to try, but in the interim maybe an Omnifocus user could confirm if this is on the right lines or wide of the mark?