App icon 1Writer

Add to Listacular

Shared by Elliott Schwartz

Format selected text and add it to a list in Listacular.

Script

var text = editor.getText();
var newText = text.replace(/[\n\r]+[-\s]*/g, ",");
var newNewText = newText.replace(/,{2,}/g, ",")
var newNewNewText = newNewText.replace(/(^[-\s]+)|(,$)/g, "");


ui.input('Which List?',null,'Enter the name of the list to add the items to.', 
function(listName) {
    if (listName) {
        url = "Listacular://list/open?listPath=" + encodeURIComponent(listName) + ".txt&appendTasks=" + encodeURIComponent(newNewNewText);
        app.openURL(url);
    }
});