Copy link to clipboard
Copied
Hi Experts, Please I need your help to increase performance to this simple scirpt, the script shouid insert 5000 number in everyline in user selected text frame but the performance is very slow and poor!, do i need to change the way of the loop? , i tried many loops methods and all of them are Slow and Poor Performance.
start = 1;
end = 5000;
var mySel = app.selection[0].parentStory
for (var i = start; i <= end; i++) {
mySel.contents += (i + "\r");
}
Please Help if you can with tips to increase the Performance!.
Thanks in Advance
Try something like this:
var start = 1,
end = 5000,
mySel = app.selection[0].parentStory,
myNums = [];
for (var i = start; i <= end; i++) {
myNums.push(i);
}
mySel.contents = myNums.join('\n');
I've generated the numbers as an array of Numbers and only at the last step put them into Indesign. Should be much quicker!
- Mark
Copy link to clipboard
Copied
Try something like this:
var start = 1,
end = 5000,
mySel = app.selection[0].parentStory,
myNums = [];
for (var i = start; i <= end; i++) {
myNums.push(i);
}
mySel.contents = myNums.join('\n');
I've generated the numbers as an array of Numbers and only at the last step put them into Indesign. Should be much quicker!
- Mark
Copy link to clipboard
Copied