Searches are not working after upgrading (3.2)

In the meanwhile, automatically quoted insert from REPL test is:


editor
    .selection
    .startItem
    .setAttribute(
        'data-search', 
        editor.itemPathFilter
    );
  1. Get your filter right in search panel
  2. Type a label for it in the editor, and place the cursor after it
  3. Run the lines above from a script assigned to a shortcut

(The parentheses get quoted automatically)

Type a search label and place the cursor in the label line

Run this script from a hotkey

Get a @search tag with automatic quoting of parentheses

Source:

function run() {

    // TASKPAPER CONTEXT
    function TaskPaperContext(editor, options) {
        editor
            .selection
            .startItem
            .setAttribute(
                'data-search',
                editor.itemPathFilter
            );
    }


    // JAVASCRIPT FOR AUTOMATION CONTEXT
    var ds = Application('com.hogbaysoftware.TaskPaper3')
        .documents;

    if (ds.length) {
        return ds[0].evaluate({
            script: TaskPaperContext.toString(),
            withOptions: {}
        });
    }
}
1 Like

Ah, cool, thanks for this. I haven’t jumped over into scripting yet, so this is very useful as an example. My next frontiers are mastering KM and Alfred integration–think I’ll end up needing to tackle scripting there.

1 Like