Komodo Macros and Extensions

Komodo macro and extension development. Share useful code samples.

XUL: Inserting Text into Text Box at Insertion Point

I have a textbox element with an id of “source”.

I have added an onkeydown event handler to intercept the tab key:

        source.onkeydown=function(e) {
                if(e.keyCode==9) {
                        e.preventDefault();     //      so far, so good
                        //      insert '\t' here
                }
        };

In JavaScript, how can I insert a character at the insertion point in the text box?

Thanks

Snippets SublimeText style

Sup, guys. Is there a way to add my snippets here?
http://cdn.joxi.ru/uploads/prod/2014/02/21/f27/f2a/7683762d018bd14bca42b...
This snippet inserts: echo '<pre>'; var_export(); echo '</pre>'; //debugging

Tools / Extension developer / JS tools broken?

I enter something simple in JavaScript Shell 1.4 but I get no output.
Like:
ko
props(ko)

Same with Javascript Dev Env
I hit Execute
"Running..."
(no more output)

What's the current state of the art to debug JS?
Or do I miss something?

Save selected text in a file

How can save selected text, in a file?

what's the right way to initialize an ext?

If you look at

https://code.google.com/p/koctags/source/browse/trunk/content/koctags.js

What's the right way to initialize an extension?

function(event) { setTimeout("gKoCtags.onLoad()", 3000); },

seems to be wrong because I cannot be sure that that 3000 is enough to wait for the UI to be built.

Any help/pointers appreciated.

PS:
If possible I'd like to do the least amount of changes...

what's wrong with this ext startup? (KO 8.5.3)

Might be I miss something, but my extension fails to find a XUL element.

koctags_ctags_tab is defined in
https://code.google.com/p/koctags/source/browse/trunk/content/bottomTabO...

    <ko-pane id="workspace_bottom_area">
        <browser type="ko-widget" id="koctags_ctags_tab" label="CTags"
                 position="10" insertbefore="codebrowserviewbox"
                 src="chrome://koctags/content/bottomTabPane.xul"/>
    </ko-pane>

But there's an exception on startup:

-- EXCEPTION START --
TypeError: this.treeElement is null

Compile LESS on Save -- Macro Help

I have just discovered that the LESS extension is no longer a) compatible with 8.5.3 and b) no longer maintained by the originator. Fine, with syntax coloring recently added to Komodo, I'm almost good.

I want to compile my LESS files on save. I have a macro that invokes the LESSC compiler just fine. It just does a:

ko.run.runEncodedCommand(window, 'lessc %F > %D/%b.css');

This works great. But I want to run that on file save -- IF and only IF the file has a file type of .LESS. I don't have the macro skills to build that macro.

Incompatible themes - is there any way to make them run?

Hello, it's my first post there, I hope that I have chosen the right subforum.

I'm pretty new to Komodo. I have updated it to 8.5 and then I tried extensions for the first time. Extensions database is very impressive, I found few functionalities that I was dreaming of, but some of them are incompatible with Komodo 8.5 (e.g. ColorTab, MySQL Database Explorer or Aero Theme). Is there any wayaround to make them work with 8.5 version?

Sorry, if there is similar topic. I was looking for that information, but I hadn't found it.

PS. I use Windows 7.

Macro: File from Template...

Hello guys,

how can i open a new buffer with predefined content via macro, like "Menu" -> "File from Template...".
The generated macro with the recorder isnt very useful.

I would be thankful for any help.

Enhanced Key Combos

In Komodo Edit 8, I used an autohotkey script to

1. Save current document 2. Change focus to my browser 3. Reload the page

LiveReload works for this, but has a 5 second delay on my machine. I am not sure why.

I also used one to remap CapsLock to only toggle with Shift+Capslock, which allowed me to use CapsLock as a modifier key for other key combos. For example, I used Tab for Komodo Snippets and CapsLock for Emmet.

Unfortunately, I can no longer get autohotkey to work within Komodo.

I. Suggestion, consider offering the CapsLock as modifier option within Komodo.