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.

UltraEdit.activeDocument.write("Active document has index="+getActiveDocumentIndex());
/* Find the tab index of the active document */
function getActiveDocumentIndex() {
var tabindex = -1; /* start value */
for (var i = 0; i < UltraEdit.document.length; i++)
{
if (UltraEdit.activeDocument.path==UltraEdit.document[i].path) {
tabindex = i;
break;
}
}
return tabindex;
}



Jorrasdk wrote:Hi IDM Support
Feature request: UltraEdit.activeDocumentIdx
New scripting read only property which returns the tab index of the currently active file.
Should return -1 if there are no open files in the editor.
Up to now I have used a function shown below ( getActiveDocumentIndex() ) to find the index of the active document, but it is tedious to always have this function in my script (as we can't include other scripts yet.
I need UltraEdit.activeDocumentIdx to know which document to return to if I have performed some newFile's or setActive's on other files. It is also nice to create aliases to simplify code like this:
- Code: Select all
var mySourceDoc = UltraEdit.document[UltraEdit.activeDocumentIdx];
UltraEdit.newfile();
var myNewWorkDoc = UltraEdit.document[UltraEdit.activeDocumentIdx];
mySourceDoc.selectLine();
myNewWorkDoc.write(mySourceDoc.selection);
Regards
jorrasdk








