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
"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)
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.
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.
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)
Copy link to clipboard
Copied
and how to apply this script to windows ?
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.
Copy link to clipboard
Copied
Yes this was about the Finders labels and not those of Bridge…