Action

Add Lines to List (caller)

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

UPDATES

6 months ago

Updated to be compatible with Add Lines to List, v4.0.

Use this action to call action Add Lines to List, v4.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 = 'Test List 1';
    
    //
    // The markdown heading level for target lists. If '', '###'
    // will be used.
    //
    let _newListHeading = '####';
    
    //
    // The markdown font size for target lists. If '', '80%'
    // will be used.
    //
    let _theListFontSize = '60%';
    
    //
    // The markdown font family for target lists. If '',
    // '"Courier New", Courier, Monaco, "DejaVu Sans Mono", monospace'
    // will be used.
    //
    let _theListFontFamily = '"Courier New", Courier, Monaco, "DejaVu Sans Mono", monospace';
    // let _theListFontFamily = '"Helvetica Neue", "Helvetica", sans-serif';
    
    // -------------------------------------------------------
    // 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 = true;
    
    //
    // If `true`, the target list is loaded into the Drafts Editor
    // after it is updated.
    //
    let _viewListAfterSuccess = true;
    
    //
    // If `true`, the target list is previewed using 'HTML Preview'
    // after it is updated.
    //
    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;
    
    // -------------------------------------------------------
    // Boolean options below can be displayed (and changed) at
    // runtime if an empty draft is visible when the action is
    // is run and _promptOptionsIfDraftIsEmpty = true.
    // -------------------------------------------------------
    
    //
    // If `true`, the target list is loaded into the Drafts Editor
    // if an empty draft is visible when the action is
    // is run.
    //
    let _viewListIfDraftIsEmpty = true;
    
    //
    // If `true`, the target list is previewed using 'HTML Preview'
    // if an empty draft is visible when the action is
    // is run.
    //
    let _previewListIfDraftIsEmpty = true;
    
    //
    // If `true`, the action displays a dialog that includes boolean 
    // options _viewListIfDraftIsEmpty and _previewListIfDraftIsEmpty
    // if an empty draft is visible when the action is
    // is run.
    //
    let _promptOptionsIfDraftIsEmpty = 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.