Lightroom: Plugin Development : Loop through selected photos and set flags and colors

  • 1
  • Question
  • Updated 1 year ago
  • (Edited)
I have what I think is a simple idea, but am having trouble figuring it out from the SDK. I want to:
  1. Loop through the current folder or selected photos
  2. Evaluate the existing color and rating
  3. Set the flag value based on criteria in #2
Looking in the SDK it appears that I can loop through the currently selected photos, but this only returns a photo object and the color labels and flag is not available.

Alternatively I can use the "new" LrSelection object, but there are no examples, so I can't figure out how to enumerate or loop through the selected photos.

If this is the wrong place to ask this let me know. If you know of a plugin that already does this I'd be grateful.
Photo of Matthew McDermott

Matthew McDermott

  • 6 Posts
  • 0 Reply Likes
  • perplexed

Posted 1 year ago

  • 1
Photo of Tapani Otala

Tapani Otala

  • 13 Posts
  • 3 Reply Likes
The color label and flag status are available in each photo object via the getRawMetadata(key) and setRawMetadata(key, value) APIs using the "colorNameForLabel" and "pickStatus" keys, respectively. Check out the SDK API reference for the details.
Photo of Matthew McDermott

Matthew McDermott

  • 6 Posts
  • 0 Reply Likes
OMG, I honestly looked and did not see that. Thank You!
Photo of John R. Ellis

John R. Ellis, Champion

  • 3725 Posts
  • 976 Reply Likes
If you have further questions about plugin development, please post on the LR SDK forum: https://forums.adobe.com/community/lightroom/lightroom_sdk/content?filterID=contentstatus%5Bpublishe... 
Photo of Matthew McDermott

Matthew McDermott

  • 6 Posts
  • 0 Reply Likes
I should clarify, the link works if I don't log in. When I try to login it all breaks. Same results on 3 different computers.
Photo of John R. Ellis

John R. Ellis, Champion

  • 3725 Posts
  • 976 Reply Likes
Try deleting all "adobe" cookies in your browser and the browser cache.  About once a year I get weird stuff happening with Adobe's forum sites (two different hosted software providers) and deleting cookies and cached pages fixes it.
Photo of Matthew McDermott

Matthew McDermott

  • 6 Posts
  • 0 Reply Likes
Thanks, I did that and like I said, it works for viewing but fails when I try to log in. Makes it really hard to ask questions. That's how I ended up here.
Photo of Alan Harper

Alan Harper

  • 424 Posts
  • 84 Reply Likes
I don't know what that "redirected too many times" message is, but I get it on some google sites when I use Chrome. When I use Safari, the page works perfectly. (On Macintosh, latest versions of all software).
Photo of John R. Ellis

John R. Ellis, Champion

  • 3725 Posts
  • 976 Reply Likes
Someone else just reported that they weren't able to download the LR SDK until they disabled their VPN.   If you're on a VPN, that might be worth trying.  VPNs are supposed to be transparent to higher levels in the protocol stack, but I guess that's not always the case.