Copy link to clipboard
Copied
Hey there!
I was using Photoshop for years on my Mac, but recently moved to a more powerful Windows PC. So unfortunately all my time saving Applescripts are not working any longer - like this one here:
tell application "Adobe Photoshop 2020"
activate
set Doc_Ref to the current document
tell Doc_Ref
set theClippingPath to path item 1
create selection theClippingPath feather amount 0.5 with antialiasing
deselect path item 1
delete path item 1
cut selection
end tell
end tell
Does anybody know how I can "translate" this one to a .jsx file, so I can run the script on my windows machine.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
I don't know of any automated converter. I'm guessing that the two languages are just too different. Automated search/replace to change key words would be possible, however, I'm guessing that only simple scripts would translate and work correctly. More time would likely be spent debugging a conversion than simply rewriting in the required language. It can be hard enough translating between human languages, computer langauges are not as forgiving.
Let's look at one simple line of code, top row AppleScript, bottom row JavaScript/ExtendScript:
|
set |
Doc_Ref |
to the current document |
|
var |
Doc_Ref |
= app.activeDocument; |
Did you write the AppleScripts yourself?
Do you know JavaScript?
Do you know how to create actions? Actions would need to have "helper scripts" to work around limitations, such as selecting the first path by index number and not by absolute name. But an action could then do everything else.
Copy link to clipboard
Copied
A literal "translation" from AppleScript would be similar to the code below. I don't know how to write AppleScript, however it is easy enough to read simple code.
#target photoshop
var doc = app.activeDocument;
doc.pathItems[0].makeClippingPath(); // why when it is deleted later?
doc.pathItems[0].select();
doc.pathItems[0].makeSelection(0.5, true, undefined);
doc.pathItems[0].deselect(); // why deselect the path?
doc.pathItems[0].remove(); // why delete?
doc.selection.cut();
Why make a clipping path, when the clipping path is deleted?
Why deselect the path?
Why delete the clipping path?
Copy link to clipboard
Copied
Hey @pierres57154409 are you out there?
Find more inspiration, events, and resources on the new Adobe Community
Explore Now