forked from finale-lua/lua-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
expression_remove_enclosure.lua
37 lines (34 loc) · 1.63 KB
/
expression_remove_enclosure.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
function plugindef()
finaleplugin.RequireSelection = true
finaleplugin.Author = "Robert Patterson"
finaleplugin.Copyright = "CC0 https://creativecommons.org/publicdomain/zero/1.0/"
finaleplugin.Version = "1.1"
finaleplugin.Date = "March 20, 2021"
finaleplugin.CategoryTags = "Expression"
return "Expression Remove Enclosure", "Expression Remove Enclosure", "Removes any enclosure on any single-staff text expression in the currently selected region."
end
local library = require("library.general_library")
local expression = require("library.expression")
function expression_remove_enclosure()
local current_part = library.get_current_part()
local expression_assignments = finale.FCExpressions()
expression_assignments:LoadAllForRegion(finenv.Region())
for expression_assignment in each(expression_assignments) do
if not expression_assignment:IsShape() and expression_assignment:IsSingleStaffAssigned() then
if expression.is_for_current_part(expression_assignment, current_part) then
local expression_def = finale.FCTextExpressionDef()
if expression_def:Load(expression_assignment.ID) then
if expression_def.UseEnclosure then
local enclosure = expression_def:CreateEnclosure()
if (nil ~= enclosure) then
enclosure:DeleteData()
end
expression_def:SetUseEnclosure(false)
expression_def:Save()
end
end
end
end
end
end
expression_remove_enclosure()