7 Replies Latest reply on Apr 23, 2016 11:25 AM by RicSum

    Open a folder in Finder?

    RicSum Level 1

      Hi,

      I had the script below in a .jsx file, and it was located at "Adobe Photoshop CC 2015/Presets/Scripts", and it worked perfectly.

      Now for some unknown reason - it will no longer open the hard-coded folder in the finder

       

      Has something changed in a previous update, which renders this script useless?

      Any ideas how I now simply open up a folder in the finder, directly from a script?

       

      Thank you all in advance.

       

       

      var f = File('Applications/Files/Photoshop\ Tuts\ and\ Plugins/Photoshop\ Plugins/'); 

      f.execute();

        • 1. Re: Open a folder in Finder?
          SuperMerlin Level 5

          You are using a File object where it should be a Folder object.

          You are mixing forward and back slash, when useing backslash you Must use \\

           

          var f = Folder('Applications/Files/Photoshop/Tuts/and/Plugins/Photoshop/Plugins/'); 

          if(f.exists){

          f.execute();

          }else{

              alert("Folder does not exist\nPlease check your path!");

          }

          1 person found this helpful
          • 2. Re: Open a folder in Finder?
            RicSum Level 1

            Hi.

            Thank you for the response, but now all I get is the alert message saying the path does not exist?

             

            I have renamed the directory names, so here is the script which I now have:

             

            var f = Folder('Applications/Files/Photoshop_Tuts_and_Plugins/Photoshop_Plugins');

            if(f.exists){

            f.execute();

            }else{

                alert("Folder does not exist\nPlease check your path!");

            }

             

            I have double checked the spelling and the path, and it is all correct, so I still have no idea why this folder is not opening?

            Screen Shot 2016-04-23 at 17.59.28.png

             

            Any other ideas would be welcomed.

            • 3. Re: Open a folder in Finder?
              xbytor2 Level 4

              var f = Folder('Applications/Files/Photoshop_Tuts_and_Plugins/Photoshop_Plugins');

               

              should probably be

               

              var f = Folder('/Applications/Files/Photoshop_Tuts_and_Plugins/Photoshop_Plugins');

              • 4. Re: Open a folder in Finder?
                SuperMerlin Level 5

                Run this line of code from ExtenScript Toolkit and select the folder

                 

                $.writeln(decodeURI(Folder.selectDialog("Please select folder")));

                 

                Your correct path should then be written to the console and you can copy it from there.

                1 person found this helpful
                • 5. Re: Open a folder in Finder?
                  RicSum Level 1

                  xbytor2: The preceeding slash made no difference

                   

                  SuperMerlin: The console returned this:

                  /Applications/Files/Photoshop_Tuts_and_Plugins/Photoshop_Plugins

                   

                  So it seems that with or without the preceeding slash,, it still refuses to work?

                  • 6. Re: Open a folder in Finder?
                    SuperMerlin Level 5

                    If that is what was returned then this should work.

                    var f = Folder("/Applications/Files/Photoshop_Tuts_and_Plugins/Photoshop_Plugins"); 

                    if(f.exists){

                    f.execute();

                    }else{

                        alert("Folder does not exist\nPlease check your path!");

                    }

                    1 person found this helpful
                    • 7. Re: Open a folder in Finder?
                      RicSum Level 1

                      That worked this time!

                      Must have been due to using double quotes, as opposed to the original single quotes??

                       

                      Thank you so much for all the help, both of you.

                      It is very much appreciated!