[JW Lua] Visible Property and more

Jari Williamsson jari.williamsson at mailbox.swipnet.se
Mon Nov 18 19:57:02 CET 2013


Chris,

I've now put an example on the Wiki that explains how to create a page 
text that's visible in one part only:
http://jwmusic.nu/jwplugins/wiki/doku.php?id=jwlua:quickscripts&#create_page_text_in_one_part_only

In your code, I noticed that you used the ^fontTxt() Enigma tag. Do NOT 
use ^fontTxt() for page text blocks (only use it for expressions that i 
in a category that support a specific text font). Instead, use ^font().

Regarding the problem with saving the FCGroup object, there's one script 
thing that needs to be changed: on Finale 2011 and higher you should use 
SaveNew(0) for groups (groups are stored in the global staff set 
nowadays). However, there's also a bug in JW Lua that prevent FCGroup 
objects to get created from scratch. I'll look into this bug and try to 
have it fixed in the next beta version.

Thanks!


Best regards,

Jari Williamsson

On 2013-11-18 15:34, GMail wrote:
> 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
>
>
>
> _______________________________________________
> JWLua mailing list
> JWLua at jwmusic.nu
> http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu
>






More information about the JWLua mailing list