I'd like a script that prompts me for a file mask and then closes all the files currently open in the editor that match that mask.
E.g. "*.txt" would close all the .txt files open in the editor.
Thanks!
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.



var nFileCount = UltraEdit.document.length;
// Is at least 1 file open?
if (nFileCount > 0) {
// Let the user enter the file extension string.
var sExtension = UltraEdit.getString("Enter file extension",1);
// The user should enter just the file extension, for example
// just TXT. In case there is something left the file extension
// like "*." or just "." remove that part of the entered string.
var nPointIndex = sExtension.lastIndexOf('.');
if (nPointIndex >= 0) sExtension = sExtension.substr(++nPointIndex);
// Normally it makes sense to run the file close loop only when the
// remaining string is not empty now.
if (sExtension.length) {
// Convert the file extension to lower case.
sExtension = sExtension.toLowerCase();
// Run the file closing loop from last to first. Running it in reverse
// direction is important whenever a loop is executed on a dynamic
// list which removes items from the list. Because removing an item
// from the list results in moving everything with a higher index
// down in the list, removing items from first to last would need to
// permanently check the modified list count property and the index
// can be increased only when an item is not removed. Running the
// loop in reverse order from last to first avoids all that problems
// and the loop is executed much faster.
var nFileIndex = nFileCount;
do {
var sActFileExtension = GetFileExt(--nFileIndex);
if (sExtension == sActFileExtension.toLowerCase()) {
UltraEdit.closeFile(UltraEdit.document[nFileIndex].path,0);
}
}
while (nFileIndex);
}
}var nFileCount = UltraEdit.document.length;
// Is at least 1 file open?
if (nFileCount > 0) {
// Let the user enter the file extension string.
var sExtension = UltraEdit.getString("Enter file extension",1);
// The user should enter just the file extension, for example
// just TXT. In case there is something left the file extension
// like "*." or just "." remove that part of the entered string.
var nPointIndex = sExtension.lastIndexOf('.');
if (nPointIndex >= 0) sExtension = sExtension.substr(++nPointIndex);
// Normally it makes sense to run the file close loop only when the
// remaining string is not empty now.
if (sExtension.length) {
// Run the file closing loop from last to first. Running it in reverse
// direction is important whenever a loop is executed on a dynamic
// list which removes items from the list. Because removing an item
// from the list results in moving everything with a higher index
// down in the list, removing items from first to last would need to
// permanently check the modified list count property and the index
// can be increased only when an item is not removed. Running the
// loop in reverse order from last to first avoids all that problems
// and the loop is executed much faster.
var nFileIndex = nFileCount;
do
if (UltraEdit.document[--nFileIndex].isExt(sExtension)) {
UltraEdit.closeFile(UltraEdit.document[nFileIndex].path,0);
}
}
while (nFileIndex);
}
}