Action

Meeting Notes & OmniFocus Tasks

Posted by @RegularCraig, Last update over 5 years ago

This action takes the content of your draft, parses any lines you have entered beginning with - and sends them as tasks to OmniFocus, then sends the contents of the Draft to the share sheet*, to send to a note app of your choice (I use OneNote).

*I use the Share sheet as OneNote doesn’t yet support URL schemes on iOS

Credit to @clarke for the majority of this action.

Steps

  • script

    // Start every line with a - to denote it as a task
    
    const taskPrefix = "-";
    
    // Function for removing the task prefix
    function removeTaskPrefix(s) {
      var f       = (taskPrefix),
          r       = "",
          re      = new RegExp(f,"g"),
          matches = s.match(re);
    
      if (matches) {
        return s.replace(re,r);
      }
    }
    
    // Function to perform the callback url
    function doCallbackURL(url, params) {
      var cb = CallbackURL.create();
      cb.baseURL = url;
    
      for(var key in params) {
       cb.addParameter(key, params[key]);
      }
    
      var success = cb.open();
      if (success) {
        console.log("Event created");
      } else {
        console.log(cb.status);
        if (cb.status == "cancel") {
          context.cancel();
        } else {
          context.fail();
        }
      }
    }
    
    // Scan for the task prefix in the draft
    var lines = draft.content.split("\n");
    
    for (var line of lines) {
      // If the line includes the task prefix, 
      // we remove exclude it from the final notes
      if (line.startsWith(taskPrefix)) {
    
        // Remove the trigger from the line
        var task = removeTaskPrefix(line);
    
        // OmniFocus URL Action
        doCallbackURL("omnifocus://x-callback-url/paste", {
          "content": task,
          "target": "inbox"
        });
     }
    }
    
  • share

    template
    [[draft]]

Options

  • After Success Archive , Tags: meetings
    Notification Info
    Log Level Error
Items available in the Drafts Directory are uploaded by community members. Use appropriate caution reviewing downloaded items before use.