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
jwlua:fullscripts [2013/08/28 08:34]
jariw created
jwlua:fullscripts [2013/10/08 08:06] (current)
jariw
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]]. 
 + 
 +The [[jwlua:​harpglisssample|Using JW Lua - Create Harp Gliss]] page also contains a full script that might be of interest.
  
 ==== Locked Systems Per Page ==== ==== Locked Systems Per Page ====
Line 87: Line 89:
 end end
 </​code>​ </​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.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
 +
 +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.)
 +local mmrests = finale.FCMultiMeasureRests()
 +mmrests:​LoadAll()
 +for mm in each (mmrests) do
 +    if region:​IsMeasureIncluded(mm.StartMeasure) or region:​IsMeasureIncluded(mm.EndMeasure) then        ​
 +        mm:​DeleteData()
 +    end
 +end
 + 
 +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
 +mm:​Save()</​code>​
jwlua/fullscripts.1377678885.txt.gz · Last modified: 2013/08/28 08:34 by jariw