Skip to main content
johnrellis
Legend
November 8, 2021

P: SDK: The new photo:copySettings() and :pasteSettings() don't work

  • November 8, 2021
  • 9 replies
  • 1106 views

The LR 11 SDK API Reference for LrPhoto documents two new methods, photo:copySettings() and photo:pasteSettings().  But as documented, they don't do anything. 

 

Update: The documentation is highly incomplete and needs to be clarified. See below.

 

To reproduce:

 

1. Copy this script into the file "copypaste.lua" and save it in the Scripts subfolder of the "Lightroom" preferences folder:

 

 

 

local catalog = import "LrApplication".activeCatalog ()
local photos = catalog:getTargetPhotos ()
if #photos ~= 2 then 
    import "LrDialogs".message ("Select exactly 2 photos")
    return
    end
photos [1]:copySettings ()
photos [2]:pasteSettings ()
catalog:withWriteAccessDo ("copy/paste", function ()
    photos [1]:copySettings ()
    photos [2]:pasteSettings ()
    end)

 

 

 

 

2. Restart LR.

 

3. Choose a photo and set its Exposure to +5.

 

4. Select that photo and another, with the first photo most selected.

 

5. Do the menu command Scripts > copypaste. 

 

Observe that the progress bar briefly shows "Paste Settings", but the Exposure = +5 setting isn't copied to the second photo.

This topic has been closed for replies.

9 replies

johnrellis
Legend
February 12, 2022

@Rikk Flohr: Photography, this has been fixed in the LR SDK 11.2.

johnrellis
Legend
December 18, 2021

[This post contains formatting and embedded images that don't appear in email. View the post in your Web browser.]

 

@Rikk Flohr: Photography, if the documentation was fixed, it wasn't released:

 

https://developer.adobe.com/console/servicesandapis 

 

 

 

 

 

Rikk Flohr_Photography
Community Manager
December 14, 2021

Updates to the Adobe Photography Products were released today and contain a fix for this issue. Please install the update via your Creative Cloud Desktop App or your respective App Store. 

 

Note: 

You may need to refresh the Creative Cloud App for desktop software to show an update available.  ([Ctrl/Cmd]+[Alt/Opt]+ [ R ])

For Mobile downloads, it may take several days for the update to appear in your respective App Stores.

 

Thank you for your patience. 

Rikk Flohr: Adobe Photography Org
johnrellis
Legend
November 13, 2021

"Can you check if the setting that you intend to copy is already selected?"

 

When I selected Exposure in Photo > Develop Settings > Copy Settings, then the script above does indeed Copy Settings.  

 

So this bug report is thus about documenting the behavior of photo:copySettings() and photo:pasteSettings() -- the current API reference doesn't mention that they use whatever was selected in the UI or that there should be a delay between the two calls.

 

Thanks for the clarifications.

Adobe Employee
November 12, 2021

copySettings API behaves as doing copy operation from UI without the dialog(with Alt/Opt key pressed), so only options/settings selected previosuly will get copied. Can you check if the setting that you intend to copy is already selected? 

johnrellis
Legend
November 11, 2021

"If there is a delay between copy and paste, the APIs should work as expected."

 

Hmm, I inserted a 5-second sleep between copySettings() and pasteSettings(), and the settings still don't get copied:

local LrDialogs = import "LrDialogs"
local LrTasks = import "LrTasks"

local catalog = import "LrApplication".activeCatalog ()

LrTasks.startAsyncTask (function ()
    local photos = catalog:getTargetPhotos ()
    if #photos ~= 2 then 
        LrDialogs.message ("Select exactly 2 photos")
        return
        end
    photos [1]:copySettings ()
    LrTasks.sleep (5)
    photos [2]:pasteSettings ()
    catalog:withWriteAccessDo ("copy/paste", function ()
        photos [1]:copySettings ()
        LrTasks.sleep (5)
        photos [2]:pasteSettings ()
        end)
    LrDialogs.message ("Finished")
    end)

 

I also tried invoking copySettings() and pasteSettings() from separate scripts, same negative result.

 

Interestingly, when I invoke the script in Develop rather than Library, LR switches to the Library module and then back to Develop.  So those methods are doing something. 

Adobe Employee
November 11, 2021

@johnrellis copySettings operation is asynchronous in nature, due to which the immediate pasteSettings call does not work as intended. If there is a delay between copy and paste, the APIs should work as expected.

Going forward, we will explicitly mark the copySettings API as async so that it does not lead to any confusion.

Rikk Flohr_Photography
Community Manager
November 9, 2021

Set status to investigating

Rikk Flohr: Adobe Photography Org
Sunil_Bhaskaran
Inspiring
November 9, 2021

Thanks John.
We will investigate.

 

Thanks,
Sunil