1 Reply Latest reply on Mar 5, 2009 11:37 PM by Kasyan Servetsky

    Open File Dialog Box (JS)

    Justin Monsees Level 1
      I know that in order to open a file dialog box and get a file I have to use this code:

      myFile = File(File.openDialog("Import XML","XML Files: *.xml"))

      This is what I use to open XML files. Now I want to be able to open a folder based on the label of the textFrame. I can get the label and build the file path. How can I open a dialog box that already points to a specific folder? Also, how can I check with the script if there are files within the folder?

      Thanks,

      Justin M.
        • 1. Re: Open File Dialog Box (JS)
          Kasyan Servetsky Level 5
          >How can I open a dialog box that already points to a specific folder?

          var myFolder=Folder("/C/XYZ");
          
          var myMask="INDD:*.indd";
          var myFile=myFolder.openDlg("Select Files To Open", myMask, true);


          >Also, how can I check with the script if there are files within the folder?

          var myFolder = Folder.selectDialog("Please select path to files");
          
          if (myFolder!=null) {
          var fileList = myFolder.getFiles();
          alert("The selected folder contains " + fileList.length + " files.");
          }