Welcome to the IDM Forum. This forum is meant as a user-to-user support mechanism where users can share knowledge and tips for all IDM software.
Since these forums are user-to-user based, IDM does not regularly read or reply to the posts in this forum. For problem reports, suggestions, or feature requests, you must email us directly. Our trained technical support staff answers most inquiries within 30 minutes.

function CopyBookmarkedLines () {
// Remember active caret position.
var nActLine = UltraEdit.activeDocument.currentLineNum;
var nActCol = UltraEdit.activeDocument.currentColumnNum;
if (typeof(UltraEdit.activeDocumentIdx) == "undefined") nActCol++;
// Move caret to top of file.
UltraEdit.activeDocument.top();
// Move caret to next bookmark.
UltraEdit.activeDocument.gotoBookmark(-1);
// Get line number of first bookmark.
var nFirstBookmark = UltraEdit.activeDocument.currentLineNum;
// Is the caret still on first line of the file?
if (nFirstBookmark > 1) {
// No, then the file has bookmarked lines. But it is possible that
// first line is also bookmarked and the caret is now already on
// second bookmark. To check this, the Goto Previous Bookmark command
// is executed next. If the line number is then 1, the first line
// is bookmarked, otherwise the first Goto Next Bookmark command
// moved the caret really to first bookmarked line in the file.
UltraEdit.activeDocument.previousBookmark();
if (UltraEdit.activeDocument.currentLineNum != 1) {
UltraEdit.activeDocument.gotoLine(nFirstBookmark,1);
} else nFirstBookmark = 1;
// Copy the first bookmarked line to active clipboard.
UltraEdit.activeDocument.selectLine();
UltraEdit.activeDocument.copy();
var nLineCount = 1;
// Append all other bookmarked lines to active clipboard.
while (1) {
UltraEdit.activeDocument.gotoBookmark(-1);
if (UltraEdit.activeDocument.currentLineNum == nFirstBookmark) {
// All bookmarked lines copied. Restore initial position
// of the caret and return the number of copied lines.
UltraEdit.activeDocument.gotoLine(nActLine,nActCol);
return nLineCount;
}
UltraEdit.activeDocument.selectLine();
UltraEdit.activeDocument.copyAppend();
nLineCount++;
}
}
else {
// Yes, either the first line is bookmarked and the first line is the
// only bookmarked line, or the file does not contain any bookmark.
// Bookmark on first line is very difficult to find out because it
// is possible that the file contains only a string at top of the
// file and no line termination at all (= no second line). The command
// Next Bookmark moves caret to start of active line or does not move
// the caret depending on configuration setting "Bookmark column with
// line" if no bookmark is set. However, with moving the caret one
// character to right if at start of first line ore to left and
// additionally one line down (if there is a second line), remembering
// the caret position, running Next Bookmark command again and check
// the new caret position, it can be find out if the first line is
// bookmarked or not, independent of the configuration setting and
// if there is a second line at all or not. It is possible that one
// bookmark is set on empty file, but then there is nothing to copy.
if (UltraEdit.activeDocument.isColNum(1)) {
UltraEdit.activeDocument.key("RIGHT ARROW");
} else {
UltraEdit.activeDocument.key("LEFT ARROW");
}
UltraEdit.activeDocument.key("DOWN ARROW");
var nFilePos = UltraEdit.activeDocument.currentPos;
UltraEdit.activeDocument.gotoBookmark(-1);
if (UltraEdit.activeDocument.currentPos == nFilePos ||
UltraEdit.activeDocument.currentLineNum == 2) {
UltraEdit.activeDocument.gotoLine(nActLine,nActCol);
return 0;
}
// Just the first line of the file is bookmarked. Copy that line
// to the clipboard and move caret back to initial position.
UltraEdit.activeDocument.selectLine();
UltraEdit.activeDocument.copy();
UltraEdit.activeDocument.gotoLine(nActLine,nActCol);
return 1;
}
}
if (UltraEdit.document.length > 0) {
var nCopiedLines = CopyBookmarkedLines();
if (!nCopiedLines) UltraEdit.messageBox("The active file does not contain any bookmarked line.","Copy Bookmarked Lines");
else {
var sLine = (nCopiedLines == 1) ? "line" : "lines";
UltraEdit.messageBox(nCopiedLines.toString() + " bookmarked " + sLine + " copied to clipboard.","Copy Bookmarked Lines");
}
}