[JW Lua] FCMeasureNumberRegion alignments not changing

Joseph Weidinger jsphweid at gmail.com
Mon May 4 23:23:53 CEST 2015


Thanks. I didn't know about the finale. prefix but I do now...  Even still
however, MN_ALIGN_CENTER doesn't seem to do anything even if I put a 1 in
there.  Run this script (which changes to a score-style measuring system).
The alignment should read "center" on all the measure number position
boxes, but they don't, at least for me.

-- delete existing regions
local mNumRegions = finale.FCMeasureNumberRegions()
mNumRegions:LoadAll()
for m in eachbackwards(mNumRegions) do
   m:DeepDeleteData()
end

--------------------- 1 - displayed region ------------------------------
-- establish font info for displayed measure numbers
local multipleFontInfo = finale.FCFontInfo()
multipleFontInfo.Bold = true
multipleFontInfo.Name = "Times New Roman"
multipleFontInfo.Size = 22

local multiAndMultiMeasureFontInfo = finale.FCFontInfo()
multiAndMultiMeasureFontInfo.Italic = true
multiAndMultiMeasureFontInfo.Name = "Times New Roman"
multiAndMultiMeasureFontInfo.Size = 10

newRegion = finale.FCMeasureNumberRegion()
if newRegion then

   -- basics
   newRegion.StartMeasure = 1
   newRegion.EndMeasure = 999
   newRegion.UseScoreInfoForParts = false

   -- SCORE --
   newRegion:SetExcludeOtherStaves(true)
   newRegion:SetShowOnBottomStaff(true)
   newRegion:SetShowOnMultiMeasureRests(true)
   newRegion:SetShowMultiples(true)
   -- multiple font info and position
   newRegion:SetMultipleFontInfo(multipleFontInfo)
   newRegion:SetMultipleAlignment(finale.MNALIGN_CENTER) --- BROKEN>>>??
   newRegion:SetMultipleJustification(finale.MNJUSTIFY_CENTER)
   newRegion:SetMultipleHorizontalPosition(0)
   newRegion:SetMultipleVerticalPosition(-270)

   -- LINKED PARTS --
   newRegion:SetExcludeOtherStaves(true, true)
   newRegion:SetShowOnTopStaff(true, true)
   newRegion:SetShowMultiples(true, true)
   newRegion:SetShowMultiMeasureRange(true, true)
   -- multiple font info and position for parts
   newRegion:SetMultipleFontInfo(multiAndMultiMeasureFontInfo, true)
   newRegion:SetMultipleAlignment(finale.MNALIGN_CENTER, true) ---
BROKEN>>>??
   newRegion:SetMultipleJustification(finale.MNJUSTIFY_CENTER, true)
   newRegion:SetMultipleHorizontalPosition(0, true)
   newRegion:SetMultipleVerticalPosition(-175, true)
   -- multimeasure font info and position for parts
   newRegion:SetMultiMeasureFontInfo(multiAndMultiMeasureFontInfo, true)
   newRegion:SetMultiMeasureAlignment(finale.MNALIGN_CENTER, true) ---
BROKEN>>>??
   newRegion:SetMultiMeasureJustification(finale.MNJUSTIFY_CENTER, true)
   newRegion:SetMultiMeasureHorizontalPosition(0, true)
   newRegion:SetMultiMeasureVerticalPosition(-175, true)
   newRegion:SaveNew()
end

--------------------- 2 - hidden region ------------------------------

-- establish font info for hidden measure numbers
local hiddenFontInfo = finale.FCFontInfo()
hiddenFontInfo.Bold = true
hiddenFontInfo.Name = "Times New Roman"
hiddenFontInfo.Size = 22
hiddenFontInfo.Hidden = true

newHiddenRegion = finale.FCMeasureNumberRegion()
if newHiddenRegion then
   newHiddenRegion.StartMeasure = 1
   newHiddenRegion.EndMeasure = 999
   newHiddenRegion.UseScoreInfoForParts = false

   newHiddenRegion:SetShowOnMultiMeasureRests(true)
   newHiddenRegion:SetShowMultiples(true)

   -- multiple font info and position
   newHiddenRegion:SetMultipleFontInfo(hiddenFontInfo)
   newHiddenRegion:SetMultipleAlignment(finale.MNALIGN_CENTER) ---
BROKEN>>>??
   newHiddenRegion:SetMultipleJustification(finale.MNJUSTIFY_CENTER)
   newHiddenRegion:SetMultipleHorizontalPosition(0)
   newHiddenRegion:SetMultipleVerticalPosition(-270)

   newHiddenRegion:SaveNew()
end

On Mon, May 4, 2015 at 3:50 PM, Jari Williamsson <
jari.williamsson at mailbox.swipnet.se> wrote:

> Joseph,
>
> Charles is correct. Always try to use the constant names (the constants
> are prefixed with "finale.") even if you know what the number is.
>
> Perhaps you missed the listconstants.lua script which I put on the list in
> the distant past? I now put that script on the tips site:
> http://finaletips.nu/index.php/download/category/31-jw-lua-scripts
>
> The documentation should tell what constant prefix you should search for
> (such as "MNJUSTIFY_").
>
>
> Best regards,
>
> Jari Williamsson
>
>
> On 2015-05-04 18:39, Charles O. Lawrence wrote:
>
>> Why not use the defined constants instead of hardwiring numbers?  Here
>> are the current values:
>>
>> MNALIGN_CENTER = 1
>>
>> MNALIGN_LEFT = 0
>>
>> MNALIGN_RIGHT = 2
>>
>> MNJUSTIFY_CENTER = 2
>>
>> MNJUSTIFY_LEFT = 0
>>
>> MNJUSTIFY_RIGHT = 1
>>
>> Use them like this:
>>
>> region:SetStartAlignment(finale.MNALIGN_LEFT)
>>
>> They may not be correct.  Jari can verify that.
>>
>> Charles Lawrence
>>
>> *From:*JWLua [mailto:jwlua-bounces at jwmusic.nu] *On Behalf Of *Joseph
>> Weidinger
>> *Sent:* Monday, May 4, 2015 9:55 AM
>> *To:* Jw Lua Mailing List
>> *Subject:* [JW Lua] FCMeasureNumberRegion alignments not changing
>>
>>
>> I am making a script that makes new measure number regions.  It was
>> going great until I started to change the position with:
>>
>> SetStartAlignment()
>>
>> SetStartJustification()
>>
>> SetMultiMeasureAlignment()
>>
>> SetMultiMeasureJustification()
>>
>> The documentation seems weird to me (
>>
>> http://www.finaletips.nu/frameworkref/group__lua__classes.html#ga934c898f4ebbf7cbca683e424c641462
>> ).  I gathered it needed a number argument and based on a table I saw in
>> your PDK, it looks like 0 should be Left, 1 should be Center, 2 should
>> be Right.  However, the actual order is not Left Center Right but Left
>> Right Center. Furthermore, passing these numbers into
>> SetStartAlignment() and SetMuliMeasureAlignment() don't affect it at
>> all. It simply defaults to Left every time.
>>
>> Another way of seeing it based on my experiments:
>>
>> start
>>
>> 0 0 left left
>>
>> 1 1 left right
>>
>> 2 2 left center
>>
>> multimeasure
>>
>> 0 0 left left
>>
>> 1 1 left right
>>
>> 2 2 left center
>>
>> So to summarize, it seems no number passed into SetStartAlignment or
>> SetMultiMeasureAlignment (and presumably SetMultipleAlignment) changes
>> the value to anything other than left.  Am I missing something...?
>>
>>
>>
>> _______________________________________________
>> JWLua mailing list
>> JWLua at jwmusic.nu
>> http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu
>>
>>
>
>
> _______________________________________________
> JWLua mailing list
> JWLua at jwmusic.nu
> http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://jwmusic.nu/pipermail/jwlua_jwmusic.nu/attachments/20150504/a2f150f3/attachment-0002.html>


More information about the JWLua mailing list