Action

Inspect Draft Properties

Posted by agiletortoise, Last update over 5 years ago

This action creates a new draft with all the property information from the current draft added as a Markdown list before the draft. Useful for inspecting the creation/modification dates/locations, etc. of the current draft.

Steps

  • script

    // Build a tag with all of a the draft's
    // property information.
    
    var s = "";
    
    function add(key, val, link) {
      if (link) {
        s += "- **" + key + "**: [" + val + "](" + link + ")\n";
      }
      else {
        s += "- **" + key + "**: " + val + "\n";
      }
    }
    
    function mapLink(lat, long) {
    	return "http://maps.apple.com/?q=" + lat + "," + long;
    }
    
    add("Created", draft.createdAt);
    add("Created Location", draft.createdLatitude + "," + draft.createdLongitude, mapLink(draft.createdLatitude, draft.createdLongitude));
    
    add("Modified", draft.modifiedAt);
    add("Modified Location", draft.modifiedLatitude + "," + draft.modifiedLongitude, mapLink(draft.modifiedLatitude, draft.modifiedLongitude));
    
    add("Archived", draft.isArchived ? "Yes" : "No");
    add("Flagged", draft.isFlagged ? "Yes" : "No");
    
    s += "\n\n";
    
    s += draft.content;
    
    draft.setTemplateTag("draftproperties", s);
    
  • url

    template
    drafts5://x-callback-url/create?text=[[draftproperties]]
    useSafari
    false
    encodeTags
    true

Options

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