[JW Lua] metatools and MNALIGN

Joseph Weidinger jsphweid at gmail.com
Mon Jul 6 16:09:03 CEST 2015


Hi Jari, welcome back and thanks for all you do.

I have a few things:

1. Can you use Lua in expressions and articulations to ASSIGN metatools /
keys? I couldn't find it anywhere.

2. ALIGNMENT IN MEASURE NUMBER REGIONS
I'm pretty sure none of these work for whatever reason. Justify works but
alignment does not. Just punch in the script below into any document and
see.

If I set the value to 1, for example (finale.MNALIGN_CENTER), the value
always remains 0 (finale.MNALIGN_LEFT). If I change it manually in the GUI,
and get the value again, it will read 1 (center). But I cannot change it to
1 with Lua.

So these method don't work.
SetMultiMeasureAlignment
SetMultipleAlignment
SetStartAlignment (presumably)

<<<<<<<<<<<<<<<<script>>>>>>>>>>>>>>>>
-- delete all current regions
local mNumRegions = finale.FCMeasureNumberRegions()
mNumRegions:LoadAll()
local region = finale.FCMeasureNumberRegion()

for k = mNumRegions.Count,1,-1 do
   region:Load(k)
   region:DeleteData(k)
end

-- ====== the constants ======
-- MNALIGN_CENTER = 1
-- MNALIGN_LEFT = 0
-- MNALIGN_RIGHT = 2
-- MNJUSTIFY_CENTER = 2
-- MNJUSTIFY_LEFT = 0
-- MNJUSTIFY_RIGHT = 1

-- make new test region
newRegion = finale.FCMeasureNumberRegion()
if newRegion then

-- basics
newRegion.StartMeasure = 1
    newRegion.EndMeasure = 999
    newRegion:SetShowMultiples(true)

    -- by default...
print("the current multiple alignment is",
newRegion:GetMultipleAlignment(false)) -- reads 0, GUI shows Left
print("the current multiple justification is",
newRegion:GetMultipleJustification(false)) -- reads 0, GUI shows Left

-- now I'll set them both to center
newRegion:SetMultipleAlignment(finale.MNALIGN_CENTER, false) -- should make
it CENTER, or 1
newRegion:SetMultipleJustification(finale.MNJUSTIFY_CENTER, false) --
should make it CENTER, or 2

print("the current multiple alignment is",
newRegion:GetMultipleAlignment(false)) -- reads 0 still instead of 1, GUI
shows Left still...
print("the current multiple justification is",
newRegion:GetMultipleJustification(false)) -- reads 2, correct, GUI shows
Center, correct
 -- now let's try both to right
newRegion:SetMultipleAlignment(finale.MNALIGN_RIGHT, false) -- should make
it RIGHT, or 2
newRegion:SetMultipleJustification(finale.MNJUSTIFY_RIGHT, false) -- should
make it RIGHT, or 1

print("the current multiple alignment is",
newRegion:GetMultipleAlignment(false)) -- reads 0 still instead of 2, GUI
shows Left still...
print("the current multiple justification is",
newRegion:GetMultipleJustification(false)) -- reads 1, correct, GUI shows
Right, correct
newRegion:SaveNew()
end

<<<<<<<<<<<<<<<<script>>>>>>>>>>>>>>>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://jwmusic.nu/pipermail/jwlua_jwmusic.nu/attachments/20150706/dcbf8ab7/attachment-0002.html>


More information about the JWLua mailing list