Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #6916

    David
    Participant

    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
    {
    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.

    #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;

    #6924

    David
    Participant

    Hi,Yutaka,A lot thanks to you!

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.