local region = finenv.Region() if region:IsEmpty() then return end -- Scan to find the highest bracket position in the selected measures: local highest = -10000 local count = 0 for m = region.StartMeasure, region.EndMeasure do local endingrepeat = finale.FCEndingRepeat() local backwardrepeat = finale.FCBackwardRepeat() if endingrepeat:Load(m) then if endingrepeat.VerticalTopBracketPosition > highest then highest = endingrepeat.VerticalTopBracketPosition end count = count + 1 end if backwardrepeat:Load(m) then if backwardrepeat.TopBracketPosition > highest then highest = backwardrepeat.TopBracketPosition end count = count + 1 end end if count > 1 then -- Set the new bracket positions: for m = region.StartMeasure, region.EndMeasure do local endingrepeat = finale.FCEndingRepeat() local backwardrepeat = finale.FCBackwardRepeat() if endingrepeat:Load(m) then endingrepeat.VerticalTopBracketPosition = highest endingrepeat:Save() end if backwardrepeat:Load(m) then backwardrepeat.TopBracketPosition = highest backwardrepeat:Save() end end end