Action

Tasks in OmniFocus

Posted by agiletortoise, Last update almost 4 years ago

Send each line of the draft to OmniFocus as a new task. Each task must be confirmed in OmniFocus.

Steps

  • script

    // split draft into lines
    const lines = draft.content.split("\n");
    const baseURL = "omnifocus://x-callback-url/add";
    
    // loop over lines and send each to OmniFocus
    for(var line of lines) {
    	if (line.length == 0) { continue; }
    	// create and configure callback object
    	var cb = CallbackURL.create();
    	cb.baseURL = baseURL;
    	cb.addParameter("name", line);
    	// open and wait for result
    	var success = cb.open();
    	if (!success) {
    		if (cb.status == "cancel") {
    		   context.cancel();
    		   break;
    		}
    		else {
    			context.fail();
    			break;
    		}
    	}
    }

Options

  • After Success Default
    Notification Info
    Log Level Info
Items available in the Drafts Directory are uploaded by community members. Use appropriate caution reviewing downloaded items before use.