Copy link to clipboard
Copied
I've searched the documentation, AppleScript dictionary as well as the Adobe forums here and can't find a way to convert a layer to a Smart Object. Is it possible?
I haven't checked the AS scripting reference, however, both AS and JS DOM coding is limited. What the DOM doesn't cover, one can usually achieve using AM code (Action Manager). The most accessible form of this is recorded by the ScriptingListener plug-in.
AppleScript can call "inline" code or reference an external script file to perform tasks not directly covered in the AS DOM.
The AM code to convert the active layer to an Embedded Smart Object:
executeAction(stringIDToTypeID("newPlacedLaye
...
Copy link to clipboard
Copied
Are you trying to Automate this fucntion? If so ehy not use Actions?
WM
Copy link to clipboard
Copied
Yes actually I'm trying to automate a series of steps like resizing and saving where creating a smart object is part of it but without using actions
Copy link to clipboard
Copied
Did you find a solution, I searched a lot and I can't find it either... 😉
Copy link to clipboard
Copied
I haven't checked the AS scripting reference, however, both AS and JS DOM coding is limited. What the DOM doesn't cover, one can usually achieve using AM code (Action Manager). The most accessible form of this is recorded by the ScriptingListener plug-in.
AppleScript can call "inline" code or reference an external script file to perform tasks not directly covered in the AS DOM.
The AM code to convert the active layer to an Embedded Smart Object:
executeAction(stringIDToTypeID("newPlacedLayer"), undefined, DialogModes.NO);
The AppleScript code:
tell application "Adobe Photoshop 2024"
set js to "executeAction(stringIDToTypeID(\"newPlacedLayer\"), undefined, DialogModes.NO);"
do javascript js
end tell
Notice how the " double-quotes in the original code have been escaped \" with a backslash as the JS code is contained within open/close double-quotes in the AS code.
Another option rather than escaping the double-quotes, is to use single-quotes:
tell application "Adobe Photoshop 2024"
set js to "executeAction(stringIDToTypeID('newPlacedLayer'), undefined, DialogModes.NO);"
do javascript js
end tell
If you wanted to reference an external JSX file:
tell application "Adobe Photoshop 2024"
activate
do javascript of file "~/Desktop/createSO.jsx"
end tell
or
tell application "Adobe Photoshop 2024"
activate
do javascript (file "Users:username:Desktop:createSO.jsx")
end tell
Copy link to clipboard
Copied
Wooow you're a boss!
I've been trying to do this with Applescript for months and I can't find a solution. Even ChatGpt can't do it 😉 Congratulations on your code
It works perfectly.
It was the only thing I didn't know how to do with Applescript on Photoshop. I don't know about Script Listener but I'll look more carefully.
Thank you very much Stephen!
Copy link to clipboard
Copied
Hi Stephen
I can't install Scripting Listener on my iMac Pro.
A priori, according to the forum, few people manage to do it.
Have you installed it on a recent mac?
Copy link to clipboard
Copied
I still use an Intel Mac.
I doubt that Adobe will update the plug-in to work with Apple Silicon as Adobe are transitioning scripting from ExtendScript and Action Manager to UXP JS and batchPlay... Later versions of Photoshop allow conversion directly to batchPlay JS without needing a plugin.
I haven't done much work with UXP, so I'll need to test if AS can use such code.
As UXP JS is cross-platform, one may have to do without using AppleScript if it can't run UXP JS.
Copy link to clipboard
Copied
An iMac Pro is Intel, so it should work. I have used it with my 2019 MacBook Pro/Sonoma so yes it does work.