[JW Lua] Visible Property and more

GMail marcel.denio at gmail.com
Mon Nov 18 15:34:50 CET 2013


Hello Jari

I'm French (excuse my English) and I use "FINALE" for about 20 years.
I also participate in a french forum 
(http://finale-logiciel-aide-gravure-musicale.eu/)
or the much talked about you and your wonderful plugins that are quick 
and ergonomic.
In my spare time I do a little programming and I tried to write a Lua 
script.
For my needs, I wrote this script that creates a text visible only on a 
part.

---
function plugindef()
    -- This function and the 'finaleplugin' namespace
    -- are both reserved for the plug-in definition.
    finaleplugin.Author = "CHRIS"
    finaleplugin.Date = "13/11/2013"
    finaleplugin.CategoryTags = "Text"
    return "Texte sur Part", "", "Cree un texte visible uniquement sur 
la part active"
end


-- demander texte a l'utilisateur
local dialog = finenv.UserValueInput()
dialog.Title = "CHRIS - Texte sur Part"
dialog:SetTypes("String")
dialog:SetDescriptions("Veuillez entrer votre texte :")
local returnvalues = dialog:Execute()

-- si annuler -> fin
if returnvalues == nil then return end

-- creer la chaine de caracteres Enigma
local myText = finale.FCString()
myText.LuaString = "^fontTxt(Arial, 0)^size(8)^nfx(0)" .. returnvalues[1]

-- creer un objet texte attachee a une page
local myPageText = finale.FCPageText()

-- positionner le texte
myPageText:SetHorizontalAlignment(finale.TEXTHORIZALIGN_LEFT)
myPageText:SetVerticalAlignment(finale.TEXTVERTALIGN_BOTTOM)

-- cacher le texte globalement
myPageText:SetVisible(false)

-- sauver
myPageText:SaveNewTextBlock(myText)
myPageText:SaveNew(1)

-- memoriser l'ID du TextBlock
local id=myPageText.TextBlockID

-- charger tous les textes attaches aux pages
pagetexts = finale.FCPageTexts()
pagetexts:LoadAll()

-- rendre visible notre texte sur la part active
for pagetext in each(pagetexts) do
      if pagetext.TextBlockID  == id  then
         pagetext:SetVisible(true)
         pagetext:Save()
         break
      end
end
---

But I did not understand how stored non linked properties. (like the 
"Visible" property).
And I do not know if my text search by TextBlockID is good.

Otherwise I also made this little script to create a group, but it does 
not work:

---
local myGroup = finale.FCGroup()
myGroup:SetStartStaff(1)
myGroup:SetEndStaff(2)
myGroup:SetStartMeasure (1)
myGroup:SetEndMeasure(32767)
myGroup.BarlineShapeID=0
myGroup.BarlineStyle=1
myGroup.BarlineUse=false
myGroup.BracketID=2           --finale.BRACKET_PIANOBRAC
myGroup.FullNameHorizontalAdjust=-48
print(myGroup:SaveNew(1))
---

In the future I will try to make more short messages.
Thank you for all your work.

Bests regards

Chris

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://jwmusic.nu/pipermail/jwlua_jwmusic.nu/attachments/20131118/0ad6e58f/attachment.htm>


More information about the JWLua mailing list