Skip to main content
Participant
June 22, 2018
Answered

Open inserterd document

  • June 22, 2018
  • 1 reply
  • 851 views

Hello,

i have some Smart Objects in my PSD Document.

Now i want to simply open it just like i have opened my main file using

var mydoc = app.open(new File(curPath + "/test.psd"));

After i want to work in this documents, but this will not be a problem.

When i try to figure out the path of this inserted document i just get a "psb" file in the temp folder.

Maybe there is another way to open a Inserted path using JS?

Sorry if I use wrong synonyms for the files, i do not work very often with photoshop, i only try to make some automated scripts using templates i get.

I mean this type of layers / inserted files:

screenshot_1wljxy.png

This topic has been closed for replies.
Correct answer JJMack

Your Screen capture is pointing at a smart object layer.  Smart Object layers are created different ways not all object are alike. If you by "Open an Inserted layer" you mean open a smart object layer Object  like a Placed Image File you need to know if the Object's Image file type is one Photoshop supports one associated with Photoshop.  For if it is not when your Photoshop script opens the Layer Object the object file may be opened by an other Adobe Application like Illustrator your Photoshop Script will not be able to edit the opened object.

Adobe Photoshop Document Object Model does not cover all of Photoshop features  Open Smart Object  may  have no DOM interface.  If that is the case you would need to use Action Manager Code in your Photoshop script.   If you are unfamiliar with Action Manager code you need to read up on that and Adobe Scriptlistener Photoshop Plug-in in Adobe's Photoshop Scripting Guide  Adobe Photoshop Scripting

When you install the scriptlistener Plug-in and then open a smart object layers Object by double clicking on the layers object icon in the layer Palette.  The Script listener will record the Action Manager Code you need to use in your Photoshop script in the Scriprlistener's log files on your desktop.

1 reply

JJMack
Community Expert
Community Expert
June 22, 2018

No when you first open a smart object layers object.  Photoshop use the layers object and create a temp work file for the user so they can update the layers object.  Objects can be many different things like a Placed RAW file.  The object is a RAW file and would be converted via ACR OK button.  Could be a Places layered Photoshop file like a PSD file the work file would be updated via Photoshop.  The object could be a vector object like a Placed Illustrator .AI or .SVG file the  work file would be updated with Adobe Illustrator.  Object are not opened in the current document and all Object are not opened in Photoshop. Photoshop scripts can not automate other Adobe Applications and Photoshop plug-in that may open. The actual object is in the smart object layer data structure or a link in the layer data structure,  When you commit your changes  to the work file via ACR OK, Illustrator Save or Photoshop Save.  Photoshop well see that the work file has been changed and will update the smart object Layers object using the work file content.   The temp file is not deleted at this point, in case you may want to make additional changes.  Photoshop will keep the work file in you temp folder and reuse if in need be.  When you close out the document with the smart  smart object layer in Photoshop.  Photoshop will delete temp files create for it.

Some  template use Smart Object layers these templates are normally update via  automating menu Layer>Smart Object Layer>Replace Content.   The replacement object needs to be the same size and resolution as the object in the Template.  For all smart Object layers have an associated layer Transform which is not updated or replaced you you replace the object content. Replacement Object need to be the same size as the existing object for the associated transform to work correctly.

If you create the template you know how you create the template. If all Smart object layers contain Photoshop objects like Placed jpeg, Tiff,  PSD. Photoshop supported files.  You can Open the layers object.  It will open as an additional document in Photoshop your script can edit save and close. If you change  save and close the work file that opens in Photoshop. When you save your changes Photoshop will updated the smart object layers object. Do not change the documents size.  The Smart Object Associated transform will not be update. If you change the Object size you would then need to change the layers associated layer transform. Which may be very hard to do if there is and distorsion involved like a perspective transform.

JJMack
Participant
June 22, 2018

Thanks for this answer. It helps me a lot to understand more what these documents do.

But how can i open a inserted layer using scripts

JJMack
Community Expert
JJMackCommunity ExpertCorrect answer
Community Expert
June 22, 2018

Your Screen capture is pointing at a smart object layer.  Smart Object layers are created different ways not all object are alike. If you by "Open an Inserted layer" you mean open a smart object layer Object  like a Placed Image File you need to know if the Object's Image file type is one Photoshop supports one associated with Photoshop.  For if it is not when your Photoshop script opens the Layer Object the object file may be opened by an other Adobe Application like Illustrator your Photoshop Script will not be able to edit the opened object.

Adobe Photoshop Document Object Model does not cover all of Photoshop features  Open Smart Object  may  have no DOM interface.  If that is the case you would need to use Action Manager Code in your Photoshop script.   If you are unfamiliar with Action Manager code you need to read up on that and Adobe Scriptlistener Photoshop Plug-in in Adobe's Photoshop Scripting Guide  Adobe Photoshop Scripting

When you install the scriptlistener Plug-in and then open a smart object layers Object by double clicking on the layers object icon in the layer Palette.  The Script listener will record the Action Manager Code you need to use in your Photoshop script in the Scriprlistener's log files on your desktop.

JJMack