Skip to main content
johnrellis
Legend
January 4, 2026

P: photo:addOrRemoveFromTargetCollection() adds or remove all selected photos rather than just "phot

  • January 4, 2026
  • 0 replies
  • 39 views

The method photo:addOrRemoveFromTargetCollection() adds or removes all selected photos from the target collection rather than just "photo".   To reproduce in LR 15.1 / Mac OS 15.7.1:

 

1. Save these lines to the file "add-remove-bug.lua" in the Lightroom Scripts folder:

local catalog = import "LrApplication".activeCatalog ()
catalog:getTargetPhoto ():addOrRemoveFromTargetCollection ()

 

2. Restart LR.

 

3. In Library, select three or more photos.

 

4. Do Scripts > add-remove-bug. Observe that all selected photos are added to the current target collection (incorrect), rather than just the most-selected photo.

 

If the developers consider the current behavior "as designed" (which would be very weird), then the documentation should be corrected to explain that behavior clearly.