--[[ This script tries to create a rectangular-selection Object mask, using the same settings as from the equivalent preset. When executed, it creates a mask that requires updating. After updating, this error will be displayed: "Unable to select an object in this photo". ]] local LrTasks = import "LrTasks" local catalog = import "LrApplication".activeCatalog () local settings = {--table: 1 Exposure2012 = 4, EnableMaskGroupBasedCorrections = true, MaskGroupBasedCorrections = {--table: 2 [1] = {--table: 3 CorrectionActive = true, CorrectionAmount = 2, CorrectionID = "DEA95CD2-B5A3-4919-A417-BE8B8916586A", CorrectionMasks = {--table: 4 [1] = {--table: 5 ErrorReason = 0, Gesture = {--table: 6 [1] = {--table: 7 MaskActive = true, MaskBlendMode = 0, MaskInverted = false, MaskSyncID = "90DF60099A3A4680952D322868176114", MaskValue = 1, Points = {--table: 8 [1] = {--table: 9 x = 0.815645, y = 0.05768}, [2] = {--table: 10 x = 0.952747, y = 0.054489}, [3] = {--table: 11 x = 0.814009, y = 0.34825}, [4] = {--table: 12 x = 0.9503, y = 0.34719}}, What = "Mask/Polygon"}}, MaskActive = true, MaskBlendMode = 0, MaskInverted = false, MaskName = "Object 1", MaskSubType = 0, MaskSyncID = "3A055BCB575B42C58C6824C8E762D82A", MaskValue = 1, MaskVersion = 1, ReferencePoint = "0.500000 0.500000", What = "Mask/Image"}}, CorrectionName = "Mask 1", CorrectionReferenceX = 0.877928, CorrectionReferenceY = 0.23867, CorrectionSyncID = "AFB7C41A81BE4F918E394F0D7BFE3CF4", LocalBlacks2012 = 0, LocalBrightness = 0, LocalClarity = 0, LocalClarity2012 = 0, LocalContrast = 0, LocalContrast2012 = 0, LocalDefringe = 0, LocalDehaze = 0, LocalExposure = 0, LocalExposure2012 = -1, LocalHighlights2012 = 0, LocalHue = 0, LocalLuminanceNoise = 0, LocalMoire = 0, LocalSaturation = 0, LocalShadows2012 = 0, LocalSharpness = 0, LocalTemperature = 0, LocalTexture = 0, LocalTint = 0, LocalToningHue = 240, LocalToningSaturation = 0, LocalWhites2012 = 0, What = "Correction"}}} LrTasks.startAsyncTask (function () local photo = catalog:getTargetPhoto () catalog:withWriteAccessDo ("Test", function () photo:applyDevelopSettings (settings) end) end)