Copy link to clipboard
Copied
Reading the Adobe JavaScript pdf. I am unable to fully comprehend how one might filter the range of available files in the File.openDialog. I'd like to have the choices limited to .csv files. I know I need to have a different method depending on whether the user is on a mac or PC.
Understanding the filter function on OSX was non obvious for me as well. There is version of the Adobe's JavasScript Tools Guide that has an actual example of the filter function, then I found this thread which has a pretty good example implementation. Then there's the StackOverflow answer to a question I posted about this issue. Hope those references help.
Copy link to clipboard
Copied
I used it once in a scipt, like this:
file = File.openDialog("Select the target file.",
File.fs.toUpperCase() === "WINDOWS" ? "Text Files:*.txt,Javascript Files (CARE OVERWRITE):*.jsx,All Files (CARE OVERWRITE):*.*" : function(f){return f.name.slice(-4)===".jsx" || f.name.slice(-4)===".txt";},
false);
I worked on Windows, i don't have a clue if it would work on Mac, never tested it.
Xavier
Copy link to clipboard
Copied
Understanding the filter function on OSX was non obvious for me as well. There is version of the Adobe's JavasScript Tools Guide that has an actual example of the filter function, then I found this thread which has a pretty good example implementation. Then there's the StackOverflow answer to a question I posted about this issue. Hope those references help.
Copy link to clipboard
Copied
Perfect answers. Working now. Thanks.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more