File Open dialog with filter
Copy link to clipboard
Copied
Hi,
When I am invoking the following command in Adobe Indesign JavaScript in Windows OS, the filter option does not work.
var myFile=File.openDialog("Choose the file","*.jsx",false);
I need to limit the types of files displayed in the dialog. "*.jsx" filter expression does not work in the dialog. It displays all types of files in the dialog.
Please suggest the solution to the above problem.
Copy link to clipboard
Copied
Try this:
function filterFiles(file){ if(file.name.match(/\.jsx$/)){return true} return false } file = File.openDialog ("Choose the file" , filterFiles, false );
Harbs
Copy link to clipboard
Copied
how modify this code to include folders (make them activate)?
because on Mac in folder's "column view" folders are grayed out and it is impossible to dig into them to reach files hidden deeper in the folders hierarchy.
Copy link to clipboard
Copied
Hi kumar1981
I use the following function.
You have to replace the ".xml" with your extension 😉
kind regards
Daniel (from Switzerland)
function maskFile(myFile) {
if (myFile.constructor.name == "Folder") { return true }
if (myFile.name.slice(-4) == ".xml") { return true }
return false;
}

