Page 1 of 1

how to know smart object image source path

Posted: Fri Apr 28, 2017 3:27 pm
by robberfree
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.

Re: how to know smart object image source path

Posted: Sat Apr 29, 2017 2:20 pm
by robberfree
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.

Re: how to know smart object image source path

Posted: Mon May 08, 2017 8:36 pm
by pixxxelschubser
Your crossposting was answered already
https://forums.adobe.com/thread/2310570

Re: how to know smart object image source path

Posted: Sun Jun 11, 2017 2:25 am
by wasfiwasfi
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) {};