Macro Monday – a new macro to dig into every Monday!

The Macro

This is a startup macro (set to trigger when Komodo starts up) that injects a menu element (“Workspace”) at startup into the Tools menu, allowing users to save the current workspace (all the currently opened files) and restore previously saved ones. It made for a pretty interesting macro, not only for utility but also for learning. I’ve dug into some different aspects of Komodo that I haven’t played with before or had less experience with:
1. ko.filepicker to using native file save/open dialogs.
2. koFileEx to programmatically generate files.
3. Exploring ko.views.manager in the JS Shell in the Komodo Extension Developer Add-on to see what information I could get from my open documents.
4. Using Komodos Dom Inspector to find necessary elements in the Tools menu to then use the xtk.domutils to create and append my new menu elements into the Komodo UI.

Installation

To install the macro simply hit the “View Resource” and “Install Instructions” links below.
Once installed – open the Macro properties and set the macro to trigger on the Komodo startup event.


Install Instructions

Related Materials

  • Komodo Developer Extension – play around with JavaScript or Python code in
    the context of the Komodo window
  • Komodo Macro API – to programatically interact with the Komodo editor – available to both Python and Javascript
  • Editor API – the Komodo editor provides a wrapper around the Scintilla API
  • DOM Inspector– the Komodo tool for inspecting DOM elements in Komodo