In many other editors, when you record a macro you can run that macro repeatedly. However, in Komodo Edit there is not an option to do so. In Komodo Edit, how do you repeat a macro X times, or repeat a macro to the end of a file?
NotePad++ lets you repeat a macro
Komodo Edit doesn't have that option in the menu
Here's how to do it in a macro (I call mine "Run current macro to end of file"):
var currentMacro = ko.macros.recorder.currentMacro;
if (!currentMacro || !currentMacro.length) {
alert("There is no current macro to execute");
return;
}
var view = ko.views.manager.currentView;
var scimoz = view.scimoz;
var startingLine = scimoz.lineFromPosition(scimoz.currentPos);
var i = 1;
scimoz.beginUndoAction();
try {
while (true) {
ko.macros.recorder.executeLastMacro();
let newPos = scimoz.currentPos;
let newLine = scimoz.lineFromPosition(newPos);
if (newLine <= startingLine) {
newLine = startingLine + 1;
}
startingLine = newLine;
if (startingLine >= scimoz.lineCount) {
break;
}
scimoz.gotoPos(scimoz.positionFromLine(startingLine));
}
} finally {
scimoz.endUndoAction();
}
You can also have macros invoke other macros, but that's a bit more complicated.