[JW Lua] Updating expression categories

Aaron Sherber aaron at sherber.com
Fri Mar 24 21:39:35 CET 2023


Thanks, Jan -- that does the trick. And that is indeed what I would call a
"weak link"! Looks like the same thing has to be done with positioning,
copying from the category to each expression that should be using it. I'm
guessing Finale must do the same thing under the covers when you make a
change to a category through the UI.

Robert, this smells like something that should be in the library, something
like category:resync_expressions() and/or expression.resync_to_category().
Do you agree? I'm going to need to add this functionality to my Options as
JSON script, so if you want it in the library I may as well make that part
of my PR.

Aaron.





On Fri, Mar 24, 2023 at 2:42 PM Jan Angermüller <jan at angermueller.com>
wrote:

> FCString:ReplaceCategoryFonts() is what you need.
> This changes "Finale Maestro" dynamics to "Bravura".
>
> local catnumber=1
> local c=finale.FCCategoryDef()
> c:Load(catnumber)
>
> local f=finale.FCFontInfo()
> c:GetMusicFontInfo(f)
> f.Name="Bravura"
> c:SetMusicFontInfo(f)
> c:Save()
>
> local te=finale.FCTextExpressionDefs()
> te:LoadAll()
> local t
> for t in each(te) do
>     if t.CategoryID==catnumber then
>         local tstr=t:CreateTextString()
>         if tstr then
>
> tstr:ReplaceCategoryFonts(c,finale.CATEGORYMODE_MUSIC,true)
>
> --tstr:ReplaceCategoryFonts(c,finale.CATEGORYMODE_TEXT,true)
>
> --tstr:ReplaceCategoryFonts(c,finale.CATEGORYMODE_NUMBER,true)
>             t:SaveTextString(tstr)
>         end
>     end
> end
>
> Jan
>
> Am 24.03.2023 um 19:22 schrieb Robert Patterson:
>
> You have to rewrite the font info in the enigma string
> <http://jwmusic.nu/jwplugins/wiki/doku.php?id=jwlua:enigmastrings>. I
> think there are library functions to help with this. Look in enigma_string
> library. Somewhere in the repo there's an example of assigning an
> expressions to a category and syncing the font, but I don't remember where
> now.
>
> On Fri, Mar 24, 2023 at 10:47 AM Aaron Sherber <aaron at sherber.com> wrote:
>
>> Hi Jan,
>>
>> Thanks -- but update how? I've tried setting and unsetting
>> UseCategoryFonts, force setting the CategoryID, and using
>> exp.AssignToCategory(), but none of those seem to work.
>>
>> Aaron.
>>
>>
>>
>>
>>
>> On Fri, Mar 24, 2023 at 11:11 AM Jan Angermüller <jan at angermueller.com>
>> wrote:
>>
>>> Hi Aaron,
>>>
>>> here is a very old mail from Jari. You need to update the expressions
>>> with an extra loop.
>>>
>>> Am 04.09.2014 um 18:29 schrieb Jari Williamsson:
>>>
>>> Some additional info: Expression defs are actually very weak linked with
>>> the categories in Finale (much more weak than the impression the UI gives).
>>> If you make changes to a category, you need to manually update all
>>> expression defs that connects that category.
>>>
>>>
>>> Jan
>>>
>>>
>>>
>>> Am 24.03.2023 um 14:06 schrieb Aaron Sherber:
>>>
>>> Hi all,
>>>
>>> If I use FCCategoryDef to change the font of a category, it appears that
>>> existing expressions which are set to use the category font don't
>>> automatically pick up this change. If I go into the Expression Designer,
>>> the expressions still show using their old font. I need to uncheck and
>>> recheck "Use Category Fonts" in order to get each expression to update.
>>> Doing this in code (i.e., looping through FCTextExpressionDefs and setting
>>> UseCategoryFont to false and then true and saving) doesn't seem to work
>>> either.
>>>
>>> Is there some programmatic way to get expressions to recognize changes
>>> to their categories?
>>>
>>> Thanks,
>>> Aaron.
>>>
>>> _______________________________________________
>>> JWLua mailing listJWLua at jwmusic.nuhttp://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu
>>>
>>>
>>> --
>>> Jan Angermüller
>>> Orchideenstieg 13
>>> 22297 Hamburg
>>> Tel. 040 - 28 94 84 82
>>> Mobil 0173 - 99 33 904www.elbsound.studio
>>>
>>> _______________________________________________
>>> 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
>>
>
> _______________________________________________
> JWLua mailing listJWLua at jwmusic.nuhttp://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu
>
>
> --
> Jan Angermüller
> Orchideenstieg 13
> 22297 Hamburg
> Tel. 040 - 28 94 84 82
> Mobil 0173 - 99 33 904www.elbsound.studio
>
> _______________________________________________
> 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/20230324/8b1ae5f1/attachment.html>


More information about the JWLua mailing list