OmniFocus scripting dictionary (Javascript) is available through Script Editor. It’s a good place to start familiarizing with OmniFocus methods and properties (Javascript).

steve:

how to use this

You can execute it in Script Editor setting language to Javascript. Additionaly, with Keyboard Maestro (as you found out), Alfred, etc…

Script update: now handles more perspectives and it is a little more polished. It returns a string with a plain text representation of a perspective. It can be used to set the clipboard to this string with Keyboard Maestro (output of an Execute a Javascript for Automation), for example.

Received great ideas from user @draft8 on passing information between KM prompt for user input action and a Execute a JavaScript For Automation action and creating specialised versions of a function to allow options.

Just implemented task notes on/off toggle. Is this what you had in mind, @TheWart ?