UltraEdit has no built-in command to copy selected lines with line numbers to clipboard.
But it is possible to run an UltraEdit script to add line numbers to text copied before to the clipboard before pasting the block into email application.
// Get content of clipboard as an array of lines assuming that the
// clipboard contains text data and the lines have carriage return
// plus line-feed as line termination.
if (UltraEdit.clipboardContent.length)
{
var asLines = UltraEdit.clipboardContent.split("\r\n");
// Remove the last string from array if being empty because
// the text in clipboard ends with a line termination.
if (!asLines[asLines.length-1].length) asLines.pop();
// Convert the number of lines to a string using decimal
// system and replace each digit in string by character 0.
var sLeadingZeros = asLines.length.toString(10).replace(/./g,'0');
// Insert at beginning of each line a number with
// leading zeros according to maximum number of lines.
for (var nLine = 0; nLine < asLines.length; nLine++)
{
var sLineNumber = (nLine+1).toString(10);
sLineNumber = sLeadingZeros.substr(sLineNumber.length) + sLineNumber;
if (asLines[nLine].length)
{
asLines[nLine] = sLineNumber + " " + asLines[nLine];
}
else // For an empty line just add the line number without spaces.
{
asLines[nLine] = sLineNumber;
}
}
// Append an empty string to array of lines to have finally the
// block in clipboard terminated with carriage return and line-feed.
asLines.push("");
// Join the modified lines back to a block in clipboard.
UltraEdit.clipboardContent = asLines.join("\r\n");
}
Copy & paste this script code into a new ANSI file and save it for example with file name Add Line Numbers.js
. Then add this script to Scripts list without hotkey for execution from scripts lists after copying a block to clipboard or with a hotkey or chord (multi-key assignment) for quick execution by key.
It is of course also possible that the script itself makes the copy of selected text.
And it is also possible to use the real line numbers in active file when a slightly modified version of this script is executed on a selected text in active file instead of clipboard content.