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

Script is not working...!!!

Engaged ,
Dec 29, 2015 Dec 29, 2015

Copy link to clipboard

Copied

Hi EveryOne,

I need to change my finder label color of file. However i get the script from Adobe forums (Re: Change Color Label of File with Javascript)

The below mentioned script getting error. Please rectify that or tell me the alternate solution.

Thanks to Christoper and Muppet Mark-QAl63s.

//myscript.sh MUST exist with execute permissions!   

  var script = new File("~/Desktop/myscript.sh");  

  var filePath=new File("~/Desktop/Source1.tif");

  script.length = 0;  

  script.lineFeed = "unix";  

  script.length = 0;  

  script.open("e");  

  script.writeln("#!/bin/bash");  

  script.writeln('Tell application "Finder" to set label index of (POSIX file "' + decodeURI(filePath) + '") to 2'); 

  script.close();  

  script.execute(); 

 

-yajiv

TOPICS
Actions and scripting

Views

512

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

Community Expert , Dec 30, 2015 Dec 30, 2015

And why

var filePath=new File("/Volumes/System SSD/Users/yajiv/Desktop/Source1.tif");

instead of

var filePath = "/Volumes/System SSD/Users/yajiv/Desktop/Source1.tif";

?

Votes

Translate

Translate
Adobe
Community Expert ,
Dec 30, 2015 Dec 30, 2015

Copy link to clipboard

Copied

I think you need to amend the path (see the example where the file would be on the HD "System SSD" and the user would be "pfaffenbichler") and you can use app.system.

#target photoshop

app.bringToFront();

var filePath= "/Volumes/System SSD/Users/pfaffenbichler/Desktop/Source1.tif";

app.system( 'osascript -e \'tell application "Finder" to set label index of file ((POSIX file \"'+filePath+'\") as alias) to 2\'');

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
Engaged ,
Dec 30, 2015 Dec 30, 2015

Copy link to clipboard

Copied

Hi Chris,

Thanks for your valuable reply. This code not working in my system.

Please suggest me what was wrong!

#target photoshop 

app.bringToFront(); 

var filePath=new File("/Volumes/System SSD/Users/yajiv/Desktop/Source1.tif"); 

app.system( 'osascript -e \'tell application "Finder" to set label index of file ((POSIX file \"'+filePath+'\") as alias) to 2\'');

-yajiv

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
Community Expert ,
Dec 30, 2015 Dec 30, 2015

Copy link to clipboard

Copied

Just to make sure: Are you working on a Mac?

Is the file "Source1.tif" definitely located on your startup disk and desktop and is it named "System SSD"?

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
Community Expert ,
Dec 30, 2015 Dec 30, 2015

Copy link to clipboard

Copied

Please open the file in Photoshop, ctrl-click the filename and post a screenshot thereof, like this:

filePathInPsd.jpg

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
Community Expert ,
Dec 30, 2015 Dec 30, 2015

Copy link to clipboard

Copied

And why

var filePath=new File("/Volumes/System SSD/Users/yajiv/Desktop/Source1.tif");

instead of

var filePath = "/Volumes/System SSD/Users/yajiv/Desktop/Source1.tif";

?

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
Engaged ,
Dec 30, 2015 Dec 30, 2015

Copy link to clipboard

Copied

Hi Chris,

it working like a charm..

Thanks you so much for your kind help..

-yajiv

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
Community Expert ,
Dec 30, 2015 Dec 30, 2015

Copy link to clipboard

Copied

LATEST

Good to know it worked out.

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