Skip to main content
Inspiring
November 4, 2018
Answered

Place linked using script

  • November 4, 2018
  • 12 replies
  • 5234 views

I am looking for a way to place linked photos directly from Lightroom.

After selecting a layer, I want to run my script which will do the following:

  • Get the layer name (this will be the linked filename + suffix, at this point dgn)
  • Open a “browse” dialog using  Folder.selectDialog to get the root path the file can be found in.
  • Recursively search down and if fileName.dgn is found place it as linked and delete the current layer.
    Or, convert the smart object in the active layer to linked

How can I recursively search down to find the file?

How can I place it as linked?

This topic has been closed for replies.
Correct answer r-bin

Replace

descriptor.putObject( stringIDToTypeID( "openAs" ), charIDToTypeID( "null" ), descriptor2 );

with

descriptor.putObject(stringIDToTypeID("openAs"), stringIDToTypeID("Adobe Camera Raw"), descriptor2 );

12 replies

karpiyonAuthor
Inspiring
November 4, 2018

Let me rephrase...

In LR I select the image ans open as smart object in PS

In PS I run my script on the smart object layer.

The reason i do this is because i do not want to navigate to the location of the image and search for it - it is time consuming task.

In my script I specify the root folder and it looks for a file whose name is equal to the PS smart layer name.

Currently i have most of the script including the recursive search for the file.

What need is a was to insert/place a file as linked from withing PS by scripting.

Dan

JJMack
Community Expert
Community Expert
November 4, 2018

karpiyon  wrote

I am looking for a way to place linked photos directly from Lightroom.

After selecting a layer, I want to run my script which will do the following:

  • Get the layer name (this will be the linked filename + suffix, at this point dgn)
  • Open a “browse” dialog using  Folder.selectDialog to get the root path the file can be found in.
  • Recursively search down and if fileName.dgn is found place it as linked and delete the current layer.
    Or, convert the smart object in the active layer to linked

How can I recursively search down to find the file?

How can I place it as linked?

How would  what you wrote be directly from Lightroom?

If you select a layer you are in Photoshop Lightroom does not support Layers.

If you target a layer in Photoshop then use place.  Place will create a Smart Object Layer above the current targeted layer and this new smart object layer will be Photoshop new current target.   If you want the Placed image file to be linked you would use Place linked not place embedded.  So the current layer would be a smart object layer with a linked image file in the layers object.  If you delete the current layer you delete the smart object layer you just placed in.  Lightroom had no part in this process.  You may have saved the file you place in using Lightroom in the past.   That was not part of your script's process.

Your script Process would put the Photoshop User into a select image file dialog.  (Not a folder select dialog) The user would navigate to the file to want placed in and select that file.  The Script would then use place Linked to place in the smart object layer with the linked image file.   The layer will not be an independent smart object layer it will be linked to you master image file.

JJMack