Skip to main content
johnrellis
Legend
Nov 8, 2021 10:28 PM UTC
Released

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

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 is closed to new replies. Start a new post to keep the conversation going.

9 replies

johnrellis
Legend
Feb 12, 2022 3:32 AM UTC

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

Translate
johnrellis
Legend
Dec 18, 2021 6:13 AM UTC

[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 

 

 

 

 

 

Translate
Rikk Flohr-Retired
Adobe Employee
Dec 14, 2021 4:06 AM UTC

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. 

Translate
Rikk Flohr: Adobe Photography Org
johnrellis
Legend
Nov 13, 2021 7:04 AM UTC

"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.

Translate
Adobe Employee
Nov 12, 2021 5:25 AM UTC

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? 

Translate
johnrellis
Legend
Nov 11, 2021 3:50 PM UTC

"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. 

Translate
Adobe Employee
Nov 11, 2021 11:54 AM UTC

@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.

Translate
Rikk Flohr-Retired
Adobe Employee
Nov 9, 2021 3:23 PM UTC

Set status to investigating

Translate
Rikk Flohr: Adobe Photography Org
Sunil_Bhaskaran
Inspiring
Nov 9, 2021 10:04 AM UTC

Thanks John.
We will investigate.

 

Thanks,
Sunil

Translate