-- Get the selected region local region = finenv.Region() -- Get the top and bottom staff local topstaff = region.StartStaff local bottomstaff = region.EndStaff -- Make sure that the swap can take place if topstaff < 1 then return end if bottomstaff < 1 then return end if topstaff == bottomstaff then return end -- Create a top region local topregion = finale.FCMusicRegion() topregion:SetRegion(region) topregion.EndStaff = topstaff -- Create a bottom region local bottomregion = finale.FCMusicRegion() bottomregion:SetRegion(region) bottomregion.StartStaff = bottomstaff -- Copy the music to clip files topregion:CopyMusic() bottomregion:CopyMusic() -- Paste top contents to the bottom staff topregion.StartStaff = bottomstaff topregion.EndStaff = bottomstaff topregion:PasteMusic() -- Paste bottom contents to the top staff bottomregion.StartStaff = topstaff bottomregion.EndStaff = topstaff bottomregion:PasteMusic() -- Release the clip files topregion:ReleaseMusic() bottomregion:ReleaseMusic() -- Make sure the original region is visually restored region:SetInDocument()