[JW Lua] Measure Number Regions

Dave Foster fozder at me.com
Thu Oct 17 14:19:03 CEST 2013


Hello all,

Second on my list of things to automate is setting the measure number regions settings, fonts and positions. I'm hoping that this will eliminate a rather tedious part of my job as these settings have to be made on every score, the font and position set in 3 different places, multiplied by the number of regions! Quite why Finale hasn't got a universal setting for this is beyond me… But I've made great strides towards it with the following:

local measureNumberRegions = finale.FCMeasureNumberRegions()
measureNumberRegions:LoadAll()
for mnr in each(measureNumberRegions) do
	print("The region starts at bar", mnr.StartMeasure, "and ends at bar", mnr.EndMeasure)

-- Use different settings in the parts
	mnr.UseScoreInfoForParts = false

-- Set the places where measure numbers appear
	mnr:SetHideFirstNumber(false, false)
	mnr:SetShowOnTopStaff(true, false)
-- Can't set it to show on Bottom Staff? (although there is a getter)
-- Can't set it to exclude other staves?
	mnr:SetShowOnSystemStart(true, false)
-- Can't set it to show on Mulitples? (although there is a getter)
-- Can't set it to show on MulitMeasure ranges? (although there is a getter)

-- Create a fontInfo object, set font & size, make plain
	local fontInfo = finale:FCFontInfo()
	fontInfo.Name = "Times New Roman"
	fontInfo:SetPlain()
	fontInfo.Size = 11

-- Set the fontInfo for the 3 settings
	mnr:SetStartFontInfo(fontInfo, false)
	mnr:SetMultipleFontInfo(fontInfo, false)
	mnr:SetMultiMeasureFontInfo(fontInfo, false)

-- Set the vertical position (can't set for MulitMeasures?)
	mnr:SetStartVerticalPosition(51, false)
	mnr:SetMultipleVerticalPosition(51, false)
-- Can't set the horizontal position for any?
-- Can't set the alignment for any?
-- Can't set the justification for any?

-- Save the measure number region
	mnr:Save()
end 

I've noted in the code various things I'm unable to get access to - some settings seem to be read only, some have properties for some things and not others, and some settings are just not available. Basically, I'm hoping to (programatically) check the 3 boxes (Start…, Every…, Multi…), check Top Staff & Exclude…, set the fonts (done!) and positions (alignment, justification, horizontal and vertical) in the 3 places.

Am I missing some functions, or are these things that could be added to the API? (I'll owe you a pint)

Cheers,

Dave






More information about the JWLua mailing list