2 Replies Latest reply on Sep 12, 2013 7:48 AM by mattdesignmule

    Open Folder Photoshop CC Win 7

    mattdesignmule

      Hello

       

      Before upgrading to Photoshop CC (from CS5.5) the following script served me well for opening a folder.

       

      var dir = Folder('Q:\\Team%20Member%20Folders\\Matt\\KOP\\Skies');

       

      var files = dir.openDlg('Choose your sky','',true);

       

      open(File(files));

       

      Since updating to Photoshop CC this script now opens the most recent folder. I am hoping someone can tell me what is wrong with it.

       

      Thanks for your help

      Matt

        • 1. Re: Open Folder Photoshop CC Win 7
          Michael L Hale Level 5

          I see one thing that is wrong and two that may be wrong. I don't think the code you posted will work in CS5.5 because of the the open() line.

           

          If the folder object stored in the variable dir is valid and you have the correct user permissions the dialog will open in that folder in Photoshop CC. However if the path is not valid or you can not access that folder because of user permissions the dialog will open in the most recent folder.

           

          openDlg() returns an array of file object, even if only one file is selected. If the user canceled the dialog without selecting a file it returns null. If you don't use a filter argument the user can select any file, including ones that Photoshop can not open.

           

          app.open() expects the first argument to be a file object. It will not accept an array. In the code you posted you are passing an array.

          var dir = Folder('Q:\\Team%20Member%20Folders\\Matt\\KOP\\Skies');
          if(dir.exists){
              var files = dir.openDlg('Choose your sky','',true);
              if(files!=null){// user selected at least one file
                  // should check that files[0] is an image file Photoshop can open before trying to open.
                  open(files[0]);// open the first file selected
              }
          }
          
          • 2. Re: Open Folder Photoshop CC Win 7
            mattdesignmule Level 1

            Thanks Michael

             

            It looks like in my case I needed to add a "\\" after "Skies". Your tip that there was a permission error got me pointed in the right direction there.

             

            So my script is now working fine but the additional code you added made it super slick, so thanks a bunch!

             

            Matt