How do I write some text to Komodo's Command Output Window from a macro?
We don't talk as much about how to present output from macros as we should.
Alert boxes certainly work, and are an easy tool for web developers, but we
all know they get old fast. As long as there's a command output window in
the UI, we might as well write output to that, right?
One of the reasons the docs don't talk about this window is that it was
designed long ago, without much thought to making it scriptable from
outside. The code is somewhat low-level, but works. It also works
from extensions, of course. One day there will probably be a
higher-level entry point in the public API. Until then a function
like this will work fine.
Let's dive into the code.
If you're following along, you can create a macro (called, maybe,
"append_to_command_output_window", but macro names are mainly for
labeling) and save this text in it.
Notice that this macro doesn't actually *do* anything. It defines
a function, in Komodo's global namespace. You can then access
that function from any other macro simply by invoking
append_to_command_output_window, as in this example:
If you give this macro an "On startup" trigger, all your other