Applescript in Photoshop script

Anyone, especially newbies, asking for help with Photoshop Scripting and Photoshop Automation - as opposed to those contributing to discussion about an aspect of Photoshop Scripting

Moderators: Tom, Kukurykus

Mcquiff

Applescript in Photoshop script

Post by Mcquiff »

I have the following code from Larsen67 and this is working.

#target photoshop

var docPath = app.activeDocument.fullName;

setFinderLabel( docPath, 2);

function setFinderLabel( fileObj, numb ) {
var sh = 'osascript -e \'Tell application "Finder"';
sh += ' to set label index of ((POSIX file "';
sh += fileObj.fsName;
sh += '") as alias) to ' + numb.toString() + '\'';
var res = app.system( sh );
res == 0 ? res = true : res = false;
return res;
};

I need to add some more conditions to the applescript.

I need to add this;
That is if the file is in a dropbox folder then make label red, else do nothing.

In applescript I need to add this is what I am looking to do.
tell application id "com.adobe.Photoshop"
set theDocument to the current document
set theFilePath to file path of theDocument
end tell

tell application "Finder"
if (theFilePath as text) contains "Dropbox" then
set label index of document file theFilePath to 2
end if
end tell



Also I will need to check if it saved first, else again do nothing,

Professional AI Audio Generation within Adobe Premiere Pro - Download Free Plugin here

larsen67

Applescript in Photoshop script

Post by larsen67 »

You can just check what the parent folder's name is using JavaScript… No need to keep going back and forth between languages…
Mcquiff

Applescript in Photoshop script

Post by Mcquiff »

only have a rough idea under applescript, javascript i know practically nothing. Your help is appreciated.

going to do some googling nonetheless