The following script does exactly that.
var fileLocation = Folder.selectDialog("Select a folder");
folder = new Folder ([fileLocation]);
folderContents = folder.getFiles("*.indd");
var openedFiles = new Array;
var filenames = new Array;
for (i=0; i<folderContents.length; i++)
str = filenames.join();
if (confirm ("Close "+str) == true)
for (i=0; i<openedFiles.length; i++)
As you can see, you are responsible yourself for keeping a list of the files you opened. But with that list, you can do some interesting stuff -- such as closing the same files again.
if i select my indesign file folder it showing close(y or n). but i want to open all the files(4) in the folder. could u tell me. i want to open all the files
through script and i want to close all the opened files
You might want to be more explicit.
I inserted the "Close [Y/N]" because without that prompt, the script would do exactly what you ask: open all files and close them again. Not very exciting, but if that's what you need, just remove the line 12 "if (confirm ("Close "+str) == true)".