This is a simple macro that I need from time to time. I used to just open my browser and write code to get the output, but now that Iām using Keyboard Maestro, I put this JavaScript code there for better access
let [begin, end] = clipboard.split("-");
const isNumber = String(Number(begin)) === begin && String(Number(end)) === end;
const lines = [];
if (isNumber) {
begin = Number(begin);
end = Number(end);
for (let i = begin; i <= end; i++) {
lines.push(i);
}
} else if (begin.length === 1 && end.length === 1) {
for (let i = begin.charCodeAt(0); i <= end.charCodeAt(0); i++) {
lines.push(String.fromCharCode(i));
}
}
lines.join("\n");