I am using this action, https://actions.getdrafts.com/a/1VJ , to make a grocery list but it sends the actions to the inbox. Is there a way to alter the script to send the list to a project called “Groceries”? Thanks for any help!
It appears from the Omnifocus URL Scheme reference that the /paste
action used in that action can take an additional target
parameter. See those docs for details (down in the “TaskPaper-Formatted text” section.
From a quick look at the script, you would need to add the parameter something like the below (snippet from script), modifying the “YOUR-PROJECT-TARGET” as appropriate:
cb.baseURL = "omnifocus://x-callback-url/paste";
cb.addParameter("content", taskPaper);
// ADD THE BELOW...
cb.addParameter("target", "YOUR-PROJECT-TARGET");
If I understand you correctly, the end of my script should appear like this, but it is still sending to the inbox.
Blockquote
// Create our OmniFocus callback object.
var cb = CallbackURL.create()
cb.baseURL = “omnifocus://x-callback-url/paste”;
cb.addParameter(“content”, taskPaper);
cb.addParameter(“target”, “Groceries”);
var success = cb.open();
if (!success) {
context.fail();
}
Not sure. I’m not an OmniFocus user to test what exactly it’s looking for. @tylerhall wrote the action, perhaps he would know?
Ok, after further experimentation, the target parameter requires a “/”.
cb.addParameter(“target”, “/Groceries”);
I’m not really familiar with TaskPaper, so is that a TaskPaper thing? If the project does not exist, Omnifocus will create it but it includes the “/” --> /Groceries … In all cases, if there is no leading / in the project name, the draft is sent to the Inbox. Its ugly but I guess I can live with it until someone solves this riddle.
The Omnifocus documentation says the following for the target parameter.
target
(can beinbox
orprojects
for top-level items; usetarget=/task/task-id
(for a specific action),target=/task/project-name
(for a specific project), ortarget=/folder/folder-name
(for a specific folder))
The slashes look to refer to the path to the project, but you seem to have dropped the initial /task
. Should your parameter adding not be the following?
cb.addParameter("target", "/task/Groceries");
Yes I tried that, but I got a project named /task/groceries in my OF list of projects. The slash is never dropped. I beautified my project list by adding 3 slashes and moving it to the top of the project list. So now it looks likes this:
///Groceries
Project 2
Project 3
etc…