Copy link to clipboard
Copied
Reading a file with cep from my js file looks like this:
var result = window.cep.fs.showOpenDialog();
alert(result.data);
Is there away where I can select a directory? The above only selects a file.
Meaning I'd like illustrator to prompt me to select a folder. After I select it in Illustrator then I could save the path.
Copy link to clipboard
Copied
To set 2nd argument to true like below.
var result = window.cep.fs.showOpenDialog(false, true, "Select folder...");
if (result.err==0) [
console.log(result.data);
}
else {
console.log(result.err);
}
Copy link to clipboard
Copied
You can find defs for the cep.fs functions in CEP Engine Extensions
/**
* Displays the OS File Open dialog, allowing the user to select files or directories.
*
* @Param allowMultipleSelection {boolean} When true, multiple files/folders can be selected.
* @Param chooseDirectory {boolean} When true, only folders can be selected. When false, only
* files can be selected.
* @Param title {string} Title of the open dialog.
* @Param initialPath {string} Initial path to display in the dialog. Pass NULL or "" to
* display the last path chosen.
* @Param fileTypes {Array.<string>} The file extensions (without the dot) for the types
* of files that can be selected. Ignored when chooseDirectory=true.
*
* @Return An object with these properties:
* <ul><li>"data": An array of the full names of the selected files.</li>
* <li>"err": The status of the operation, one of
* <br>NO_ERROR
* <br>ERR_INVALID_PARAMS </li>
* </ul>
**/
cep.fs.showOpenDialog(allowMultipleSelection, chooseDirectory, title, initialPath, fileTypes)