Close all Edit* files without prompting

Help with writing and running scripts

Close all Edit* files without prompting

Postby caveatrob » Mon Aug 23, 2010 3:30 pm

I'm trying to write a script that closes all files with the Edit* prefix that I'm using for junk and need to clear once and a while. I don't want to get save prompts when I run the script.

Any ideas?
caveatrob
Basic User
Basic User
 
Posts: 20
Joined: Fri Apr 25, 2008 4:39 pm

Re: Close all Edit* files without prompting

Postby Mofi » Tue Aug 24, 2010 1:00 am

That is very simple because new files never saved have no file name which means the file name is empty for such a "file" (better: edit buffer).

Code: Select all
// Close all new files without prompt.
var nFileIndex = UltraEdit.document.length;
while (nFileIndex--) {
   if (UltraEdit.document[nFileIndex].isName("")) {
      UltraEdit.closeFile(UltraEdit.document[nFileIndex].path,2);
   }
}
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4055
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna


Return to Scripts