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

Change Color Label of File with Javascript

Explorer ,
Mar 24, 2010 Mar 24, 2010

Copy link to clipboard

Copied

I need to be able to run a JS script from within Photoshop and when it's complete, change the color of the file in Finder to indicate it has been processed.  I'm talking about the red, orange, yellow, etc. highlights you can give the files in Finder.

I know how to change these file colors in Applescript.  But I cannot figure out how to initiate the process from JS when run inside Photoshop.

So I was curious if there was:

A.  A way to run an Applescript from Javascript

or

B.  A way to define the property of a file from JS such that Finder would interpret it into a color highlight?

Any ideas?

Thanks

TOPICS
Actions and scripting

Views

1.8K

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 , Mar 25, 2010 Mar 25, 2010

"osascript ... whatever" = osascript -e 'Tell application "Finder" to set label index of ((POSIX file "' + filePath + '") as alias) to 4' if you are using file objects fsName (POSIX path)

Votes

Translate

Translate
Adobe
Guide ,
Mar 25, 2010 Mar 25, 2010

Copy link to clipboard

Copied

As far as I know this is only available to AppleScript. I have not yet seen any examples of passing arguments from ExtendScript to complied AppleScript. I would think it is possible to do but a bit convoluted. You can use BridgeTalk to communicate with either the Bridge App to use it's system method to run a shell command (even this shell would use osascript and an AppleScript string) or communicate with InDesign which has the method 'do script' given language. I can't File.execute() on a shell with my version of Photoshop so have never looked into wether you can pass this arguments.

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
Valorous Hero ,
Mar 25, 2010 Mar 25, 2010

Copy link to clipboard

Copied

Here is some code from X that might be of use...

//myscript.sh MUST exist with execute permissions! 
  var script = new File("~/Desktop/myscript.sh");
  script.length = 0;
  script.lineFeed = "unix";
  script.length = 0;
  script.open("e");
  script.writeln("#!/bin/bash");
  script.writeln("osascript ... whatever");
  script.close();
  script.execute();

Of course you would need CS3 orr better.

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 ,
Mar 25, 2010 Mar 25, 2010

Copy link to clipboard

Copied

"osascript ... whatever" = osascript -e 'Tell application "Finder" to set label index of ((POSIX file "' + filePath + '") as alias) to 4' if you are using file objects fsName (POSIX 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 ,
Aug 05, 2013 Aug 05, 2013

Copy link to clipboard

Copied

and how to apply this script to windows ?

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
Guru ,
Aug 06, 2013 Aug 06, 2013

Copy link to clipboard

Copied

Andy_Bat1 wrote:

and how to apply this script to windows ?

This thread is about setting the file's color property, which Windows doesn't have. So you can't do this on Windows.

If you want to set the label( color ) in the XMP from Photoshop you either need to use BridgeTalk or the AdobeXMPScript lib.

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
Guru ,
Aug 06, 2013 Aug 06, 2013

Copy link to clipboard

Copied

LATEST

Yes this was about the Finders labels and not those of Bridge…

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