Forum Replies Created
Viewing 3 posts - 1 through 3 (of 3 total)
- AuthorPosts
- crowdyMember
Ah! It works
I should have read Help carefully.thanks.
crowdyMemberhow do we re-number them once it has been numbered?
I wonder if this might help
var src = "var17 = Item17.Lookup('Name17');"
var re = /d+/g;
var arr;
while ((arr = re.exec(src)) != null)
document.writeln(arr.index + "-" + arr.lastIndex + "t" + arr);
this shows
3-5 17
12-14 17
27-29 17
crowdyMembertry this
// save current position
var g_curX = document.selection.GetActivePointX(eePosLogical);
var g_curY = document.selection.GetActivePointY(eePosLogical);
function newLine() {
// make new line
document.selection.EndOfLine(false,eeLineView);
document.selection.NewLine(1);
}
function main() {
var line;
if (document.selection.IsEmpty) {
// get current single line
document.selection.StartOfLine(false, eeLineLogical);
document.selection.EndOfLine(true, eeLineLogical);
line = document.selection.Text;
} else {
line = document.selection.Text;
}
if (line.indexOf('#')>0) {
var strNum = prompt("how many times do you want to repeat?", "10");
repeatnum = parseInt(strNum);
// is it numeric?
if (!isNaN(repeatnum)) {
newLine();
// do repeat
for (var i=1; i<=repeatnum; i++) {
document.writeln(line.replace(/#/g, i));
}
}
}
document.selection.Collapse();
document.selection.SetActivePoint(eePosLogical, g_curX, g_curY);
}
main();
- AuthorPosts
Viewing 3 posts - 1 through 3 (of 3 total)