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.

Principal();
function Principal()
{
//This script requires UltraEdit v13.10 or UEStudio v6.30 or any later.
//var init
var findStr;
//Clear the output window, make it visible and disable status information.
UltraEdit.outputWindow.showStatus=false;
UltraEdit.outputWindow.clear();
if (UltraEdit.outputWindow.visible == false) {
UltraEdit.outputWindow.showWindow(true);
}
//Get the line where the cursor is.
UltraEdit.activeDocument.startSelect();
UltraEdit.activeDocument.key("END");
var findStr = UltraEdit.activeDocument.selection;
UltraEdit.activeDocument.endSelect();
// Remember current regular expression engine.
var RegexEngine = UltraEdit.regexMode;
/* A regular expression engine must be defined or the find
for the last line in the Unicode results could fail. */
UltraEdit.ueReOn();
findStr = findStr.replace(/\(.*\)/,"");
findStr = findStr.replace(/ .*/,"");
findStr = findStr.replace(/;/,"");
findStr = findStr.replace(/\,/,"");
findStr = "function " + findStr + "(";
switch (RegexEngine) { // Restore original regular expression engine.
case 1: UltraEdit.unixReOn(); break;
case 2: UltraEdit.perlReOn(); break;
default: UltraEdit.ueReOn(); break;
}
var TxtDir = "";
GetListOfFiles(0, TxtDir, "*.psl","",findStr);
// selection into var for last active tab
UltraEdit.activeDocument.top();
UltraEdit.activeDocument.key("DOWN ARROW");
UltraEdit.activeDocument.key("DOWN ARROW");
UltraEdit.activeDocument.startSelect();
UltraEdit.activeDocument.key("END");
UltraEdit.activeDocument.copy();
var wrkTimestampText = UltraEdit.activeDocument.selection;
UltraEdit.activeDocument.endSelect();
var pslFilePath = wrkTimestampText.replace(/\(.*\)/,"");
var lineFunction = wrkTimestampText.replace(/\).*/,"");
lineFunction = lineFunction.replace(/.*\(/,"");
ResultsDocTitle = "** Find Results ** " ;
for (var i = 0; i < UltraEdit.document.length; i++)
{
if (UltraEdit.document[i].path == ResultsDocTitle) {
UltraEdit.closeFile(UltraEdit.document[i].path,2);
break;
}
}
//lineFunction = parseInt( lineFunction );
lineFunction = parseInt( lineFunction );
//UltraEdit.outputWindow.write(lineFunction);
UltraEdit.open(pslFilePath);
UltraEdit.activeDocument.top();
UltraEdit.activeDocument.gotoLine(lineFunction, 0);
}
/*** GetListOfFiles *******************************************************/
This function is copyright by Mofi for free usage by UE/UES users. The
author cannot be responsible for any damage caused by this script. You
use it at your own risk.
function GetListOfFiles (FileList, Directory, FileType, SubDirs , StrLookFor) {
var SummaryInfo = "Search complete, found";
var ResultsDocTitle = "** Find Results ** "; // Note the space at end!
var OutputType = (typeof(DebugMessage) == "number") ? DebugMessage : 2;
if (typeof(FileList) != "value" || FileList < 0 || FileList > 4) FileList = 0;
if (FileList == 0) { // Search in a specified directory?
// If no directory specified, use current working directory.
if (typeof(Directory) != "string" || Directory == "" ) Directory = ".\\";
// Append a backslash if it is missing at end of the directory string.
else if (Directory.match(/\\$/) == null) Directory += "\\";
// Search for all files if no file type is specified.
if (typeof(FileType) != "string" || FileType == "") FileType = "*";
if (typeof(SubDirs) != "boolean") SubDirs = false;
} else {
Directory = ""; // For the list of open, favorite, project
FileType = ""; // or solution files the other 3 parameters
SubDirs = false; // have always the same default values.
}
// Remember current regular expression engine.
var RegexEngine = UltraEdit.regexMode;
/* A regular expression engine must be defined or the find
for the last line in the Unicode results could fail. */
UltraEdit.ueReOn();
/* Run a Find In Files with an empty search string to get the
list of files stored in the specified directory in an edit
window and delete the last line with the summary info. */
UltraEdit.frInFiles.directoryStart=Directory;
UltraEdit.frInFiles.filesToSearch=FileList;
UltraEdit.frInFiles.matchCase=false;
UltraEdit.frInFiles.matchWord=false;
UltraEdit.frInFiles.regExp=true;
UltraEdit.frInFiles.searchInFilesTypes=FileType;
UltraEdit.frInFiles.searchSubs=SubDirs;
UltraEdit.frInFiles.unicodeSearch=false;
UltraEdit.frInFiles.useOutputWindow=false;
UltraEdit.frInFiles.find(StrLookFor);
//UltraEdit.frInFiles.find("*");
// var ListCreated = false;
if (UltraEdit.activeDocument.path == ResultsDocTitle) ListCreated = true;
else {
for (var i = 0; i < UltraEdit.document.length; i++)
{
if (UltraEdit.document[i].path == ResultsDocTitle) {
UltraEdit.document[i].setActive();
ListCreated = true;
break;
}
}
}
if (ListCreated == true) {
// Search for the summary info at bottom of the results.
UltraEdit.activeDocument.findReplace.searchDown=false;
UltraEdit.activeDocument.findReplace.matchCase=true;
UltraEdit.activeDocument.findReplace.matchWord=false;
UltraEdit.activeDocument.findReplace.regExp=false;
UltraEdit.activeDocument.findReplace.find(SummaryInfo);
ListCreated = UltraEdit.activeDocument.isFound();
}
UltraEdit.activeDocument.findReplace.searchDown=true;
switch (RegexEngine) { // Restore original regular expression engine.
case 1: UltraEdit.unixReOn(); break;
case 2: UltraEdit.perlReOn(); break;
default: UltraEdit.ueReOn(); break;
}
/* Check now if the Find above has had success finding the last line in
the active document which should contain the Find In Files results. */
if (ListCreated == false) {
if (OutputType == 2) {
UltraEdit.messageBox("There is a problem with frInFiles command or one of the strings in the variables\n\"SummaryInfo\" or \"ResultsDocTitle\" is not adapted to your version of UE/UES!","GetListOfFiles Error");
} else if (OutputType == 1) {
if (UltraEdit.outputWindow.visible == false) UltraEdit.outputWindow.showWindow(true);
UltraEdit.outputWindow.write("GetListOfFiles: There is a problem with frInFiles command or one of the strings in the variables");
UltraEdit.outputWindow.write(" \"SummaryInfo\" or \"ResultsDocTitle\" is not adapted to your version of UE/UES!");
}
return false;
}
UltraEdit.activeDocument.deleteLine();
UltraEdit.activeDocument.top();
UltraEdit.activeDocument.key("RIGHT ARROW");
if (UltraEdit.activeDocument.currentPos > 1) UltraEdit.activeDocument.unicodeToASCII();
else UltraEdit.activeDocument.top();
// If top of file is also end of file, no files were found.
if (UltraEdit.activeDocument.isEof()) {
if (OutputType == 2) {
UltraEdit.messageBox("No file "+FileType+" was found in directory\n\n"+Directory,"GetListOfFiles Error");
} else if (OutputType == 1) {
if (UltraEdit.outputWindow.visible == false) UltraEdit.outputWindow.showWindow(true);
UltraEdit.outputWindow.write("GetListOfFiles: No file "+FileType+" was found in directory "+Directory);
}
UltraEdit.closeFile(UltraEdit.activeDocument.path,2);
return false;
}
return true;
}

