#6917
Yutaka Emura
Keymaster

David wrote:
Can anyone help me?
I need a plugin to duplicate selection as specified times. I only have poor knowledge about javascript.Before this, I create a macro as the following:

sCount = prompt( “Enter the times of duplication:”, “5” );
if( sCount == “” )
{
Quit();
}

for(var i=0;i<sCount;i++)
{
document.selection.DuplicateLine();
}

This macro can’t work as my expection. When 2 rows are selected and enter “3” for times. 40 rows, instead of required 6 rows are generated.
Thanks in advance.

I changed a little bit.


sCount = prompt( "Enter the times of duplication:", "5" );
if( sCount == "" )
{
Quit();
}

s2 = "";
s = document.selection.Text;
for(var i=0;i<sCount;i++)
{
s2 += s;
}
document.selection.Text = s2;