Newbie, trying to close and then choose another file

Hello

I'm doing a very simple script just to close a file and open a specific folder so I can choose another. Finally, I would like to learn much more, but even if that will allow me to save some work.

Closes the file that follows and shows the right folder but when I click on the file I want to open the name appears in the "File name" box, but it does not open, and I get an error message. If I specify the name of the file with the path, it opens but I want to be able to choose the file.

app.activeDocument.close (SaveOptions.no);

File.openDialog ("path");

I searched a lot a response but perhaps not using the right conditions?

Thank you

Gary

With File.openDialog (), you open the last used folder. To open a folder specified, use openDlg() instead. For example:

f = Folder ('/d/test').openDlg ("Select a file");
if (f !== null) {
  app.open(f);
}

See the 'JavaScript ToolsGuide CC' (helping the ESTK) file for details. It is useful filter the list of files. For example, to display only the indd files, use this:

f = file ('/d/test').openDlg ('Select files', ' InDesign: * .indd ');)

Peter

Tags: InDesign

Similar Questions

Maybe you are looking for