Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

How to select a directory (folder) using window.cep

Engaged ,
Apr 29, 2020 Apr 29, 2020

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.

TOPICS
Scripting
2.2K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Community Expert ,
Apr 29, 2020 Apr 29, 2020

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);
}

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 30, 2022 Mar 30, 2022
LATEST

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)
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines