Namespace LrSelection

This namespace provides access to the selection-based commands. Commands in this namespace that modify photos in the "selection" behave just like the main menu commands: if the grid view is currently visible then they apply to all selected photos, otherwise they only apply to the active photo.

Access the functions directly from the imported namespace.

Summary

Clears all color labels from the selection.
Decreases the rating of the selection.
Removes the active photo from the selection.
Deselects all photos except for the active photo.
LrSelection.extendSelection( direction, amount )
Extends the existing selection, selecting more photos to its beginning or end.
Sets the flag state of the selction to pick.
Sets the flag state of the selection to reject.
Returns the color label assigned to the active photo, one of: "red", "yellow", "green", "blue", "purple", "other", or "none".
Returns the pick flag state of the active photo as a number (-1 = reject, 0 = none, 1 = pick).
Returns the rating of the selection as a number (0-5).
Increases the rating of the selection.
Advances the selection to the next photo in the filmstrip.
Advances the selection to the previous photo in the filmstrip.
Clears the flag state of the selection.
Selects all photos in the filmstrip.
Selects the first photo in the selection, or in the entire filmstrip if there is no selection.
Inverts the selection in the filmstrip.
Selects the last photo in the selection, or in the entire filmstrip if there is no selection.
Deselects all photos in the filmstrip.
Sets the color label of the selection, one of: "red", "yellow", "green", "blue", "purple", or "none".
Sets the rating of the selection.
Toggles the state of the Blue color label of the selection.
Toggles the state of the Green color label of the selection.
Toggles the state of the Purple color label of the selection.
Toggles the state of the Red color label of the selection.
Toggles the state of the Yellow color label of the selection.

Functions

LrSelection.clearLabels()
Clears all color labels from the selection.

First supported in version 6.0 of the Lightroom SDK.

LrSelection.decreaseRating()
Decreases the rating of the selection.

First supported in version 6.0 of the Lightroom SDK.

LrSelection.deselectActive()
Removes the active photo from the selection.

First supported in version 6.0 of the Lightroom SDK.

LrSelection.deselectOthers()
Deselects all photos except for the active photo.

First supported in version 6.0 of the Lightroom SDK.

LrSelection.extendSelection( direction, amount )
Extends the existing selection, selecting more photos to its beginning or end. Behaves exactly like the Shift+Left/Right Arrow keys in Library grid.

First supported in version 6.0 of the Lightroom SDK.

Parameters

1. direction
(string) either "left" or "right"
2. amount
(number) number of photos to add to the selection in that direction
LrSelection.flagAsPick()
Sets the flag state of the selction to pick.

First supported in version 6.0 of the Lightroom SDK.

LrSelection.flagAsReject()
Sets the flag state of the selection to reject.

First supported in version 6.0 of the Lightroom SDK.

LrSelection.getColorLabel()
Returns the color label assigned to the active photo, one of: "red", "yellow", "green", "blue", "purple", "other", or "none". The underlying metadata values that these names map to will depend on the current Color Label Set. The default label set maps these names to "Red", "Yellow", "Green", "Blue", and "Purple". The return value "other" indicates that the photo has a label that does not match any values in the current set.

First supported in version 6.0 of the Lightroom SDK.

Return value

(string) The current color label, one of: "red", "yellow", "green", "blue", "purple", "other", or "none".
LrSelection.getFlag()
Returns the pick flag state of the active photo as a number (-1 = reject, 0 = none, 1 = pick).

First supported in version 6.0 of the Lightroom SDK.

LrSelection.getRating()
Returns the rating of the selection as a number (0-5).

First supported in version 6.0 of the Lightroom SDK.

LrSelection.increaseRating()
Increases the rating of the selection.

First supported in version 6.0 of the Lightroom SDK.

LrSelection.nextPhoto()
Advances the selection to the next photo in the filmstrip.

First supported in version 6.0 of the Lightroom SDK.

LrSelection.previousPhoto()
Advances the selection to the previous photo in the filmstrip.

First supported in version 6.0 of the Lightroom SDK.

LrSelection.removeFlag()
Clears the flag state of the selection.

First supported in version 6.0 of the Lightroom SDK.

LrSelection.selectAll()
Selects all photos in the filmstrip.

First supported in version 6.0 of the Lightroom SDK.

LrSelection.selectFirstPhoto()
Selects the first photo in the selection, or in the entire filmstrip if there is no selection. Only available in the Library module.

First supported in version 6.0 of the Lightroom SDK.

LrSelection.selectInverse()
Inverts the selection in the filmstrip.

First supported in version 6.0 of the Lightroom SDK.

LrSelection.selectLastPhoto()
Selects the last photo in the selection, or in the entire filmstrip if there is no selection. Only available in the Library module.

First supported in version 6.0 of the Lightroom SDK.

LrSelection.selectNone()
Deselects all photos in the filmstrip.

First supported in version 6.0 of the Lightroom SDK.

LrSelection.setColorLabel( label )
Sets the color label of the selection, one of: "red", "yellow", "green", "blue", "purple", or "none". The underlying metadata values that these names map to will depend on the current Color Label Set. The default label set maps these names to "Red", "Yellow", "Green", "Blue", and "Purple".

First supported in version 6.0 of the Lightroom SDK.

Parameters

1. label
(string) A color label name, one of: "red", "yellow", "green", "blue", "purple", or "none".
LrSelection.setRating( rating )
Sets the rating of the selection.

First supported in version 6.0 of the Lightroom SDK.

Parameters

1. rating
(number) A number between 0 and 5.
LrSelection.toggleBlueLabel()
Toggles the state of the Blue color label of the selection.

First supported in version 6.0 of the Lightroom SDK.

LrSelection.toggleGreenLabel()
Toggles the state of the Green color label of the selection.

First supported in version 6.0 of the Lightroom SDK.

LrSelection.togglePurpleLabel()
Toggles the state of the Purple color label of the selection.

First supported in version 6.0 of the Lightroom SDK.

LrSelection.toggleRedLabel()
Toggles the state of the Red color label of the selection.

First supported in version 6.0 of the Lightroom SDK.

LrSelection.toggleYellowLabel()
Toggles the state of the Yellow color label of the selection.

First supported in version 6.0 of the Lightroom SDK.