Duplicate and Increment

Contents  Previous  Next

 

Menu: Edit > Duplicate and Increment

 

Default Shortcut Key: Shift+F2

 

Macro function: DuplicateAndIncrement()

 

The Duplicate and Increment command is similar to the Duplicate Line command, with one important difference: as it copies the current line to a new line below, it increments any values it finds within the line.  A few examples will help illustrate its utility:

 

When the cursor is placed on a line with the following text:

 

  width1 = MainForm->WidthArray[1];

 

and the Duplicate and Increment command is issued three times, the following text will result:

 

  width1 = MainForm->WidthArray[1];

  width2 = MainForm->WidthArray[2];

  width3 = MainForm->WidthArray[3];

  width4 = MainForm->WidthArray[4];

 

Duplicate and increment also recognizes character constants...

 

  char01 = 'A';

 

would become:

 

  char01 = 'A';

  char02 = 'B';

  char03 = 'C';

  char04 = 'D';

 

... and on hexadecimal values:

 

  pos[15] := $DF;

 

becomes:

 

  pos[15] := $DF;

  pos[16] := $E0;

  pos[17] := $E1;

  pos[18] := $E2;

 

Hexadecimal values are recognized in three forms: 0xFF, FFh and $FF.

 

The examples above relate to programming, but Duplicate and Increment can also be useful in non-technical situations.  If you needed to start a numbered list of items, you could create the first line:

 

  Part No. 3141001

 

and then use Duplicate and Increment to make as many copies as needed:

 

  Part No. 3141001

  Part No. 3141002

  Part No. 3141003

  Part No. 3141004

  Part No. 3141005

 

 

bm1When the Duplicate and Increment command is issued repeatedly to duplicate a line, the status line will report a count of the number of times the command has issued.