User Tools

Site Tools


jwlua:fullscripts

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
Next revision Both sides next revision
jwlua:fullscripts [2013/08/28 08:34]
jariw created
jwlua:fullscripts [2013/09/03 08:25]
jariw [Create Tacet]
Line 1: Line 1:
-This page contains some longer scripts that are "​feature complete"​ in terms of their interaction with the Finale user. For shorter script examples, please refer to the page with [jwlua:​quickscripts|quick scripts].+This page contains some longer scripts that are "​feature complete"​ in terms of their interaction with the Finale user. For shorter script examples, please refer to the page with [[jwlua:​quickscripts|quick scripts]].
  
 ==== Locked Systems Per Page ==== ==== Locked Systems Per Page ====
Line 86: Line 86:
     pageprocesscounter = pageprocesscounter + 1    ​     pageprocesscounter = pageprocesscounter + 1    ​
 end end
 +</​code>​
 +
 +
 +==== Create Tacet ====
 +
 +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 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()
 +   -- This function and the '​finaleplugin'​ namespace
 +   -- are both reserved for the plug-in definition.
 +   ​finaleplugin.Author = "Jari Williamsson"​
 +   ​finaleplugin.RequireSelection = true
 +   ​finaleplugin.CategoryTags = "​Layout,​ Measure, Rest"
 +   ​return "​Create Tacet",​ "​Create Tacet",​ "​Creates a full tacet '​measure'​ for the selected region."​
 +end
 +
 +-- Load the multimeasure rest prefs
 +local mmrestprefs = finale.FCMultiMeasureRestPrefs()
 +mmrestprefs:​Load(1)
 +
 +-- Will not continue if auto-update of mm rests is ON
 +if mmrestprefs.AutoUpdate then
 +    print ("​Automatic Update is ON in the multimeasure preferences."​)
 +    return
 +end
 +
 +local ui = finenv.UI()
 +if ui:​AlertYesNo("​Do you want to create a tacet section in this part? All music in the region will be hidden.", ​
 +            "Are you sure?"​) ~= finale.YESRETURN then
 +    return
 +end
 +
 +-- Delete all old mm rests from the part
 +-- (In this case, it's safe to delete from the start, since no relocation of data records takes place.)
 +local mmrests = finale.FCMultiMeasureRests()
 +mmrests:​LoadAll()
 +for mm in each (mmrests) do
 +    mm:​DeleteData()
 +end
 +    ​
 +local region = finenv.Region()
 +local mm = finale.FCMultiMeasureRest()
 +mm.StartMeasure = region.StartMeasure
 +mm.EndMeasure = region.EndMeasure
 +-- Copy from the default MM rest definition
 +mm.NumberHorizontalAdjust = mmrestprefs.NumberHorizontalAdjust
 +mm.NumberVerticalAdjust = mmrestprefs.NumberVerticalAdjust
 +mm.ShapeEndAdjust = mmrestprefs.ShapeEndAdjust
 +mm.ShapeID = mmrestprefs.ShapeID
 +mm.ShapeStartAdjust = mmrestprefs.ShapeStartAdjust
 +mm.StartNumberingAt = 20000 -- A really high value here to hide the number
 +mm.SymbolSpace = mmrestprefs.SymbolSpace
 +mm.UseSymbols = mmrestprefs.UseSymbols
 +mm.UseSymbolsLessThan = mmrestprefs.UseSymbolsLessThan
 +mm.Width = mmrestprefs.Width
 +-- Create a new mm rest for the whole selected region
 +-- (it will be saved at the start measure position)
 +mm:Save()
 </​code>​ </​code>​
jwlua/fullscripts.txt ยท Last modified: 2013/10/08 08:06 by jariw