Skip to main content
AntonioGomez
Participant
August 24, 2016
Question

Edit/Rename SmartObject File Reference (Embedded PSB File)

  • August 24, 2016
  • 1 reply
  • 2342 views

Hi,

I'm able to get the File Reference of an embedded Smart Object Layer but I was wondering how to execute the corresponding ActionDescriptor to modify that specific string.

I know that Photoshop changes the name of the temporary PSB file appending numbers every time it's contents gets edited (if there are repeated files sharing the same name at the temp folder). I need more descriptive SmartObject filenames for PSDs already created.

Here my function that returns that string stored at the key4 (fileReference) of desc2 (smartObject)

Still learning how ActionDescriptors / Action Manager Code / Kevlar API works.

function getFileReference() {

    var ref = new ActionReference();

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

    var desc1 = executeActionGet(ref);

    var desc2 = desc1.getObjectValue(stringIDToTypeID('smartObject'));

   

    return desc2.getString(desc2.getKey(4));

}

Thanks!

This topic has been closed for replies.

1 reply

JJMack
Community Expert
Community Expert
August 26, 2016

I believe you would need to replace the contents of the layers object.  The only way to update the embedded object file is to open the object change the content and commit the changes.  Photoshop will then update the embedded object file. or Use Replace Smart object Layer content. This does not change the associated transform for the object, The new object should be the sane size and resolution of the original object,.

JJMack
AntonioGomez
Participant
August 26, 2016

Thanks JJMack

I'm only trying to change the actual String of the embedded SO, a way to rename the given filename when that SO was created without embedding a new one, a way to reverse the ActionDescriptor that gets that name and use it to set it. This makes sense?

JJMack
Community Expert
Community Expert
August 26, 2016

To me what your are writing is you are trying to change a smart object layer. I wrote what way I know you can use to change a smart object layer. I do not think the way you are trying to change a smart object layer is posible.

The first time you open a smart  Photoshop will cteate a work file is temp and open it  for you to work on.  This work file  not deleted removed from  temp  if you close the work file till the document containing the smart object is closed.  If  open the smart object after closing the work the work file in temp will be used again.

JJMack