how to know smart object image source path

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: xbytor, DavideBarranca, Paul MR

robberfree
Posts: 2
Joined: Fri Apr 28, 2017 3:19 pm

how to know smart object image source path

Postby robberfree » Fri Apr 28, 2017 3:27 pm

I drag one image from somewhere to ps, and convert to smart object.
can some script to detect the smart object image source path(for example:/Users/robberfree/Desktop/test.jpg)?
thanks a lot.



robberfree
Posts: 2
Joined: Fri Apr 28, 2017 3:19 pm

Re: how to know smart object image source path

Postby robberfree » Sat Apr 29, 2017 2:20 pm

if you know how to do it.please give me some tips.
I have read the 《photoshop-cc-javascript-ref-2015》,but not found the according api.
Thanks ahead.

pixxxelschubser
Posts: 25
Joined: Mon Aug 01, 2016 8:59 pm

Re: how to know smart object image source path

Postby pixxxelschubser » Mon May 08, 2017 8:36 pm

Your crossposting was answered already
https://forums.adobe.com/thread/2310570

wasfiwasfi
Posts: 24
Joined: Fri Nov 04, 2016 8:29 am

Re: how to know smart object image source path

Postby wasfiwasfi » Sun Jun 11, 2017 2:25 am

Correct !
the code provided in the adobe webpage work even on my PS CC.2015
but in order to work you need to convert smart Object to linked (Layer ---> Smart Object ---> Convert to linked).

Code: Select all

try {

var ref = new ActionReference();
ref.putEnumerated( charIDToTypeID("Lyr "), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
var layerDesc = executeActionGet(ref);
var soDesc = layerDesc.getObjectValue(stringIDToTypeID('smartObject'));
var thePath = soDesc.getPath(stringIDToTypeID("link"));
alert (thePath);
} catch (e) {};


Return to “Help Me”

Who is online

Users browsing this forum: No registered users and 2 guests