EmEditor (text editor) Forum Index
   Questions and Answers about Plug-ins
     Can anyone help me: Need a plugin - duplicate selection as specified times??
Register To Post

Threaded | Newest First Previous Topic | Next Topic | Bottom
Poster Thread
David
Posted on: 2/15/2009 5:52 pm
Just popping in
Joined: 2/15/2009
From:
Posts: 8
Can anyone help me: Need a plugin - duplicate selection as specified times??
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.
Yutaka
Posted on: 2/16/2009 12:32 pm
Webmaster
Joined: 9/28/2006
From: Redmond
Posts: 2422
Re: Can anyone help me: Need a plugin - duplicate selection as specified times??
Quote:

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;


----------------
Yutaka Emura
Developer of EmEditor
http://www.emeditor.com/

David
Posted on: 2/17/2009 9:44 pm
Just popping in
Joined: 2/15/2009
From:
Posts: 8
Re: Can anyone help me: Need a plugin - duplicate selection as specified times??
Hi,Yutaka,A lot thanks to you!
Threaded | Newest First Previous Topic | Next Topic | Top


Register To Post
 
English čeština Deutsch español français italiano 日本語 한국어 Русский 简体中文 繁體中文