Skip to main content
Participant
January 24, 2014
Question

Update Modified Content (Linked layers / Smart objects)

  • January 24, 2014
  • 1 reply
  • 1149 views

Hey guys,

Is there anything in the API for handling the new Linked layers? (CC 14.2)

Specifically, I want to be able to Update Modified Content iteratively to handle lots of nested links.

It doesn't have to be pretty, just functional, as this is a very complicated task to do manually.

Cheers

This topic has been closed for replies.

1 reply

StapledonAuthor
Participant
January 25, 2014

Partially resolved, as I was able to get placedLayerUpdateAllModified from the ScriptListener (there's an Update All Modified Content option in the Layers menu, which doesn't require layer selection).

For those interested, this works:

var idplacedLayerUpdateAllModified = stringIDToTypeID( "placedLayerUpdateAllModified" );

        executeAction( idplacedLayerUpdateAllModified, undefined, DialogModes.NO );

It would still be very useful to have some proper access in the DOM -- particularly useful would be metadata breadcrumbs from which we can retrieve all the nested file links of a Placed Linked Layer as an array (at the moment I'm simply opening and updating every file, which needs to be hard-wired to include nesting from the bottom-up, if you see what I mean).

c.pfaffenbichler
Community Expert
Community Expert
January 25, 2014

Crude, but maybe this helps:

// 2014, use it at your own risk;

#target photoshop

if (app.documents.length > 0) {

var ref = new ActionReference();

ref.putEnumerated( charIDToTypeID("Dcmn"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );

var applicationDesc = executeActionGet(ref);

var theXMP = applicationDesc.getString(stringIDToTypeID('XMPMetadataAsUTF8'));

var theFiles = new Array;

var theArray = theXMP.split("<stRef:filePath>");

for (var m = 1; m < theArray.length; m++) {

theFiles.push (theArray.slice(6,theArray.indexOf("</stRef:filePath>")));

};

if (theFiles.length > 0) {alert(theFiles.join("\n"))};

};

Edit: One problem, though: the list in the XMP metadata may not be up to date if the file has not been saved since the last linked SO has been placed or embedded.

StapledonAuthor
Participant
January 25, 2014

Interesting, I'll take a closer look at it.

The save states are an issue anyway, as anyone can be editing any SO, and I can't rely on them remembering to update it's contents and save - this is half the mission, and tbh even for myself it becomes easy to forget to update when going back and forth between many SO edits. So at the moment I forcibly ensure that all the local files are refreshed - I should probably be a bit more practical about this and check date stamps or something so only those that have changed since N time are refreshed.

Pardon the waffle, thinking out loud...

Thanks c.p.