Scripts menu in Little Outliner
This feature can trace its origin back to Fargo and UserLand Frontier. It allows you to put scripts in LO's menubar, giving super-powers to techie outliners.
by Dave Winer Thursday, January 12, 2017

This is a feature that was in Fargo, but wasn't in LO2, but as of version 1.65a it is.

For people who like demos here's a 5-minute video.

How to get started. Create an outline called menubar.opml. The top level items are the names of menus. The sub-items are the commands, and the subs under each command is the text of the script that is run when the command is chosen. You edit everything in the outliner.

When you change the text in the menubar outline, the menus automatically rebuild. You don't have to have menubar.opml open to use the commands. They will always be there when you're using Little Outliner

The language is JavaScript. The scripts are run by the browser through the built-in eval function. Your scripts can call any function inside LO2. 

As in Fargo, there is a set of functions that are pretty much guaranteed to work across versions of LO2, and you should use those whenever possible to be sure that your scripts continue to work. For historic reasons we call these functions verbs.  

I basically copied the verbs that were in Fargo, and commented out the ones that don't make sense in LO2, for example the wordpress and cms verbs. 

The file verbs don't work but they might at some time in the future, so I left them in place. 

I left the fargo verbs because they do work here, they just get the version and name of the product. In this case they will reflect the version and name of the Little Outliner app. So for example this will work:

dialog.alert (fargo.version ());

Caveat: I did very little testing of the verbs. Some of them will not work because they were specific to the Fargo environment. Use common sense. If you have encountered a verb that does not work that you think should work, report it as a bug in a comment below. Include a bit of script code to illustrate.

Pro tip: I recently learned that you can access the JavaScript debugger from one of these scripts. You can drop into the debugger by calling debugger; in your code. You have to open up JavaScript tools yourself, the debugger call won't do that for you. But it's a very important feature if you're writing complex script code. 

Historic note: These verbs came from Frontier, so Frontier programmers will feel right at home. 

I've turned comments on for this post so if you have questions you can ask them here. 

Update 1/17: More verbs and the menus are now hierarchic.