As I mentioned yesterday, Little Outliner 2 now has scripting. I thought I’d include a couple of scripts you can add to your menubar.opml file that work the the _note
attribute. Why _note
? A handful of other OPML-supporting apps — like Carbonfin Outliner, OmniOutliner — regularly support this attribute, so if you import an outline from one of these apps, you can use these scripts to easily add or view notes.
The first one simply lets you add a _note
attribute to a node via a dialog box. It also adds a icon (Little Outliner supports Font Awesome!).
add note
dialog.ask ("Insert note", "", "", function (name) {
op.attributes.setOne ("_note", name);
op.attributes.setOne ("icon", "fa fa-comment-o");
});
The second shows the note in an alert .
show note
t = op.attributes.getOne ("_note");
dialog.alert (t);
The last one is fairly complicated. I remember spending many hours trying to write this for Fargo. It will go through every node in an outline (however deeply nested) and if a node has a note, the icon will show next to it so that you know which nodes have notes.
add icon to notes
function actionHere () {
note = op.attributes.getOne ("_note");
if (note) {
op.attributes.setOne ("icon", "fa fa-comment-o");
}
}
var ctheads = 0;
op.visitAll (function (headline) {
ctheads++;
});
ctheads = ctheads - 1;
op.firstSummit ();
for (var i = 0; i<ctheads; i++) {
actionHere ();
if (op.hasSubs ()) {
op.go (right, 1);
}
else if (!op.go (down, 1)) {
op.go (up, infinity);
op.go (left, 1);
while (!op.go (down, 1)) {
op.go (left, 1);
}
}
}
actionHere ();