Action

Add Lines to List (caller)

Posted by @JimS, Last update 3 months ago - Unlisted

Use this action to call action Add Lines to List, v3.0+.

Instructions

  1. Install Add Lines to List | Drafts Directory. It will have a red icon.

  2. Install this action. It will have a green icon.

  3. Copy and rename the copied action.

  4. For the renamed action, open the Script step and set the options as needed.

  5. Select a draft and run this action.

Steps

  • script

    //
    // The tag used for target lists.
    //
    // Note: The target lists must also be archived.
    //
    let _listTag = 'list';
    
    //
    // The target list that will be updated. If set to '', the action
    // will search for all archived drafts that include a tag=listTag.
    // A dialog will appear that includes these drafts and an
    // additional option to specify a new list.
    // 
    let _theListTitle = '';
    
    //
    // The markdown heading level for target lists.
    //
    let _newListHeading = '##';
    
    // -------------------------------------------------------
    // Boolean options below can be displayed (and changed) at
    // runtime if promptOptions = true
    // -------------------------------------------------------
    
    //
    // If `true`, leading and trailing blank lines are ignored
    // as the displayed draft is processed for addition to the list.
    //
    let _trimDraft = true;
    
    //
    // If `true`, blank lines after the top text line and before 
    // the bottom text line are ignored when the displayed draft
    // is processed for addition to the list.
    //
    let _excludeInnerBlankLines = true;
    
    //
    // If `true`, appends/prepends `---` if the existing adjacent 
    // line in the list is not `---`.
    //
    let _addHorizontalRule = false;
    
    //
    // If `true`, appends/prepends `---` (if the existing adjacent 
    // line in the list is not `---`), appends/prepends 
    // YYYY-MM-DD DayOfWeek, appends/prepends `---`.
    //
    let _addCurrentDateToEachBlock = true;
    
    //
    // If `true`, lines from the displayed draft are prepended
    // to the list; otherwise lines are appended.
    //
    let _prependLines = true;
    
    //
    // If `true`, a `YYYY-MM-DD HH:MM: ` or a `HH:MM: ` prefix is 
    // added to each line before it is added to the list. It will
    // be the latter if _addCurrentDateToEachBlock = `true`.
    //
    let _addCurrentTimeToEachLine = false;
    
    //
    // If `true`, the target list is loaded into the Drafts Editor
    // after it is updated.
    //
    let _viewListAfterSuccess = false;
    
    //
    // If `true`, the target list is loaded into the Drafts Editor 
    // and the list is previewed using 'HTML Preview'.
    //
    let _previewListAfterSuccess = true;
    
    //
    // If `true`, the action displays a dialog that includes boolean 
    // options: trimDraft, excludeBlankLines, addHorizontalRule,
    // addCurrentDateToEachBlock, prependLines, addCurrentDateToEachLine,
    // viewListAfterSuccess, previewListAfterSuccess.
    //
    let _promptOptions = true;
    
  • includeAction

    name
    Add Lines to List

Options

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