Auto numbering quick bookmarks

The following macro can be associated with a keyboard shortcut for automated numbering of quick bookmarks that are keyed to a tag. This can be useful because bookmarks are not saved. For example tags could be included in comment lines. The macro toggles the bookmarks on and off.

// Macro recorded on: Wed Jan 10 2018 02:34:18 GMT-0800 (Pacific Standard Time)
komodo.assertMacroVersion(9);

var view = ko.views.manager.currentView;
var sm = view.scimoz;

sm.documentStart()

sm.documentStartExtend()
sm.documentEndExtend()
start = sm.positionFromLine(sm.lineFromPosition(sm.selectionStart))
end = sm.getLineEndPosition(sm.lineFromPosition(sm.selectionEnd))
mod1v = sm.getTextRange(start,end)
var count = 0
var count = (mod1v.match(/\[s\]/g) || []).length;
// alert(count)

var loopn = count+1
for (i =1; i<loopn; i++) {
        
        ko.find.findNextInMacro(window, 0, "[s]", 0, 2, false, false, find, true, false);
        str1 = "cmd_toggleQuickBookmark_" + String(i); 
        ko.commands.doCommand(str1)

}
1 Like

Very nice, thanks for sharing! Note that the best way for sharing this type of stuff is our Packages section, see https://community.komodoide.com/packages/submit-instructions/#pane-packages