This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
jwlua:fullscripts [2013/09/03 08:23] jariw [Create Tacet] |
jwlua:fullscripts [2013/09/24 18:08] jariw |
||
---|---|---|---|
Line 93: | Line 93: | ||
This script creates a tacet for the selected region, regardless of if the section contains music or how the measures has been configured regarding multimeasure breaks. It requires that the Automatic Update for multimeasure rests is OFF for the file. Before the tacet , a user alert is displayed. The script also requires a selected region (JW Lua will automatically tell the user if a region isn't selected). | This script creates a tacet for the selected region, regardless of if the section contains music or how the measures has been configured regarding multimeasure breaks. It requires that the Automatic Update for multimeasure rests is OFF for the file. Before the tacet , a user alert is displayed. The script also requires a selected region (JW Lua will automatically tell the user if a region isn't selected). | ||
- | Specifying the multimeasure preference record 1 doesn't really matter here (any value would load the same preference data), but generally speaking for single-instance preference records, it's good practice to load preference record 1 anyway. | + | Specifying the multimeasure rest preference record 1 doesn't really matter here (any value would load the same preference data), but generally speaking for single-instance preference records, it's good practice to load preference record 1 anyway. |
<code lua createtacet.lua>function plugindef() | <code lua createtacet.lua>function plugindef() | ||
-- This function and the 'finaleplugin' namespace | -- This function and the 'finaleplugin' namespace | ||
-- are both reserved for the plug-in definition. | -- are both reserved for the plug-in definition. | ||
- | finaleplugin.Author = "Jari Williamsson" | ||
finaleplugin.RequireSelection = true | finaleplugin.RequireSelection = true | ||
finaleplugin.CategoryTags = "Layout, Measure, Rest" | finaleplugin.CategoryTags = "Layout, Measure, Rest" | ||
Line 120: | Line 119: | ||
end | end | ||
- | -- Delete all old mm rests from the part | + | local region = finenv.Region() |
+ | |||
+ | -- Delete all old mm rests from the region | ||
-- (In this case, it's safe to delete from the start, since no relocation of data records takes place.) | -- (In this case, it's safe to delete from the start, since no relocation of data records takes place.) | ||
local mmrests = finale.FCMultiMeasureRests() | local mmrests = finale.FCMultiMeasureRests() | ||
mmrests:LoadAll() | mmrests:LoadAll() | ||
for mm in each (mmrests) do | for mm in each (mmrests) do | ||
- | mm:DeleteData() | + | if region:IsMeasureIncluded(mm.StartMeasure) or region:IsMeasureIncluded(mm.EndMeasure) then |
+ | mm:DeleteData() | ||
+ | end | ||
end | end | ||
- | + | ||
- | local region = finenv.Region() | + | |
local mm = finale.FCMultiMeasureRest() | local mm = finale.FCMultiMeasureRest() | ||
mm.StartMeasure = region.StartMeasure | mm.StartMeasure = region.StartMeasure | ||
Line 143: | Line 145: | ||
mm.UseSymbolsLessThan = mmrestprefs.UseSymbolsLessThan | mm.UseSymbolsLessThan = mmrestprefs.UseSymbolsLessThan | ||
mm.Width = mmrestprefs.Width | mm.Width = mmrestprefs.Width | ||
- | mm:Save() | + | mm:Save()</code> |
- | </code> | + |