TIP: Append to running lists with the "Add to list" action


This example action demonstrates a method to create and append to running lists in Drafts. Useful for things like capturing movies you want to see, or things you need to remember to pick up at the store.

Get the action and more details at the Action Directory, see it in action below.

A few basic modifications at the top of the action script control what categories are available to select for lists and the tag to use to assign new lists.

Append to selected file (from list of running files – a la Merlin Mann's "runx" file scheme)

Where do I find the scripts so they can be edited?


In the Drafts Directory.

Tap “+” to add a new action and select “Visit Directory”; at the moment, if you select “Recent Actions” on the resulting webpage, “Add to list” is at the top, or just search for it. Tap on the action to open it’s description.

Click on the “Install” Button and select the group to install it into in your Drafts. You can then edit it in your action list by swiping right on the action name and tapping “Edit”.

Hope this helps.


Swipe to the right on an action to get to its “Edit” screen. Details here.

You’ll need to tap on the steps, then the script step…the lines you are looking to modify are at the top of the script and look like:

// setup categories available
const categories = ["Movies", "TV Shows", "Blog Ideas"];

// tag to assign to list drafts
const listTag = "lists";

If you are not familiar with scripting it can look a little intimidating, but it’s not too bad. The categories is an array, and is just a comma-separated list of quoted strings. You can have as many or as few categories as needed.


Thank you, both of you :slight_smile: I reckon I could get the hang of that!


Thanks for this script, It will definitely see a lot of use… one question though: is there any way to add multiple items at once? Example: if I am with a friend who says “you really need to see x, y, and z” how can I modify the script to accept data points from multiple successive lines?
Thanks in advance,


Javascript’s standard Array.map can take an existing function on a single string, and apply it to a whole list of strings.

For example:

d.content = d.content + currentContent
.map(x => '- [ ] ' + x)

Used in context:

Full source for an Add *All* to List variant – click to expand
(() => {
    'use strict';

    // Based on an original script by @agiletortoise

      Ask for a category, and append to a 
      tagged list for that category

    // EDIT THIS
    // setup categories available
        categories = ['Movies', 'TV Shows', 'Blog Ideas'],

        // EDIT TAG
        // tag to assign to list drafts
        listTag = 'lists',

        // grab text
        currentContent = draft.content.trim(),

        // A prompt for selecting an item from a list.
        p = categories.reduce(

            // Accumulator updates - a button added for 
            // each category in the list:
            (prompt, buttonName) => {
                return prompt;

            // Initial accumulator: a prompt with properties:
                Prompt.create(), {
                    title: 'Select list:',
                    message: 'Ask for a category, and append' +
                        ' to a tagged list for that category',
                    isCancellable: true

    return p.show() ? (() => {
            category = p.buttonPressed,

            // query for list drafts...
            drafts = Draft.query(category, 'inbox', [listTag]),

            // index of first draft that matches a condition
            iDraft = drafts.findIndex(
                draft => draft.content.startsWith('## ' + category)

            d = iDraft !== -1 ? (
            ) : Object.assign(
                Draft.create(), {
                    content: '## ' + category + '\n\n'

        return (
            // tag and update content

            d.content = d.content + currentContent
            .map(x => '- [ ] ' + x)

    })() : (

JS :: Building prompts with Array.reduce and Object.assign

Is there a way to cross off [x] items e.g. from a shopping list?


They are tappable task marks. Is that what you are asking?


Experimenting with a version that:

  • collects the category names from the top of the list drafts
  • adds a prompt to create a new category / list draft

Not listed, so it doesn’t step on Greg’s example, but you can look at it here.


Yes I have those. But to delete the ones done. I.e. in a shopping list it deletes the items you have picked up leaving the ones you need, when you next open the note.
Hope that makes sense.


Great addition. Thanks.


This is great, thanks!


You can modify this action that I created which moves the done tasks to the bottom of the list to do what you need.


Re the final lines of that action

begin = begin.slice(0,-1);
end = end.slice(0,-1);
editor.setText(begin + "\n" + end);
  • My understanding is that update is a method, so presumably it needs to be called with a trailing parentheses ? d.update()

(rather than just evaluating to a function value ?)


Is it possible to run this script without the check boxes?


You know what I’d like here? I’d like the action to turn each listed item into a tappable link to search Google or Duck Duck Go so when I later come back to the list it’s easy to look up whatever the thing is.


This great thanks appreciated.


Is there a way to adapt this script to prepend rather than append text to an existing draft? I keep a running list of favourite quotes with the most recent at the top. At the moment when I open the draft each time and the cursor default to the end of the text. I’ve had a look but coding isn’ t my strong point!

Thanks in advance.



Yes, it’s certainly possible to alter the script to put new list items at the top. A little more complex if you want to maintain the heading, since the script would have to local the right insertion point, not just tack text on the top.

Not restoring the last cursor position is a bug in the current release which will be fixed in the next update.