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

Open a folder in Finder?

Participant ,
Apr 23, 2016 Apr 23, 2016

Copy link to clipboard

Copied

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

TOPICS
Actions and scripting

Views

466

Translate

Translate

Report

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

correct answers 1 Correct answer

Guide , Apr 23, 2016 Apr 23, 2016

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!");

}

Votes

Translate

Translate
Adobe
Guide ,
Apr 23, 2016 Apr 23, 2016

Copy link to clipboard

Copied

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!");

}

Votes

Translate

Translate

Report

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
Participant ,
Apr 23, 2016 Apr 23, 2016

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

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
Advisor ,
Apr 23, 2016 Apr 23, 2016

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

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
Guide ,
Apr 23, 2016 Apr 23, 2016

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

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
Participant ,
Apr 23, 2016 Apr 23, 2016

Copy link to clipboard

Copied

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?

Votes

Translate

Translate

Report

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
Guide ,
Apr 23, 2016 Apr 23, 2016

Copy link to clipboard

Copied

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!");

}

Votes

Translate

Translate

Report

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
Participant ,
Apr 23, 2016 Apr 23, 2016

Copy link to clipboard

Copied

LATEST

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!

Votes

Translate

Translate

Report

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