[JW Lua] metatools assignments
Joseph Weidinger
jsphweid at gmail.com
Sun Nov 8 15:07:40 CET 2015
So I moved that above metatool assignment and wrapped a print around
AssignTextExpressionDef. Still no metatool assignment but it *does* return
true...
On Sun, Nov 8, 2015 at 7:55 AM, Jan Angermüller <jan at angermueller.com>
wrote:
> I haven't tested it, but maybe call ted:SaveNew() *before *assigning the
> metatool ?
> I am not sure, but the text expression might need "to be registered in the
> system" before assigning the metatool.
> Does AssignTextExpressionDef
> <http://www.finaletips.nu/frameworkref/class_f_c_metatool_assignment.html#ab9c22e27b1d9d30357d5a8d63b775acb>
> return true ?
>
>
>
> Am 08.11.2015 um 14:39 schrieb Joseph Weidinger:
>
> Thanks. However, I did all of those things and it still does assign the
> metakey. Here is the updated part + the rest of the relevant code in case
> maybe it is part of a larger problem (?).
>
> function makeBoldAbove(expressionText)
> local ted = finale.FCTextExpressionDef()
>
> -- actual text
> stringObject = finale.FCString()
> stringObject.LuaString = "^fontTxt(Times New Roman,4096)^size(14)^nfx(1)"
> .. expressionText
> ted:SaveNewTextBlock(stringObject)
>
> -- description
> local descriptionstr = finale.FCString()
> descriptionstr.LuaString = expressionText -- get it from userinput also,
> why not
> ted:SetDescription(descriptionstr)
>
> -- put into which category?
> catdef = finale.FCCategoryDef()
> catdef:Load(4) -- 4 is expressions
> ted:AssignToCategory(catdef)
>
> -- we will not use standard positioning
> ted:SetUseCategoryPos(false)
>
> -- here is the positioning data
>
> ted:SetVerticalAlignmentPoint(finale.ALIGNVERT_ABOVE_STAFF_BASELINE_OR_ENTRY)
> ted:SetVerticalBaselineOffset(-26)
> ted:SetVerticalEntryOffset(36)
> ted:SetHorizontalJustification(finale.EXPRJUSTIFY_LEFT)
> ted:SetHorizontalAlignmentPoint(finale.ALIGNHORIZ_CLICKPOS)
> ted:SetHorizontalOffset(0)
> ted:SetBreakMMRest(false)
>
>
> local ma = finale.FCMetatoolAssignment()
> ma:SetMode(finale.MTOOLMODE_EXPRESSION)
> ma:AssignTextExpressionDef(ted)
> ma:SaveAsKeystroke(65)
>
> ted:SaveNew()
>
> return ted:GetItemNo()
> end
>
> local expressionID = makeBoldAbove("test") -- create it and get its new ID
>
>
> On Sun, Nov 8, 2015 at 5:47 AM, Jari Williamsson <
> jari.williamsson at mailbox.swipnet.se> wrote:
>
>> Joseph,
>>
>> In addition to what Jan said:
>> * Remove the call to SaveNew(), since it isn't needed. SaveNew() should
>> only be used for classes that can save a list of objects to the same
>> location. SaveAsKeyStroke() is the SaveAs method to use for metatool
>> assignments.
>>
>> * Put the AssignTextExpressionDef before the save, otherwise the
>> connection to the text expression def will not be saved to Finale.
>>
>>
>> Best regards,
>>
>> Jari Williamsson
>>
>> On 2015-11-08 11:07, Jan Angermüller wrote:
>>
>>> As the online documentation says for AssignTextExpressionDef:
>>> "The mode for the object must be set to MTOOLMODE_EXPRESSION *in
>>> advance*. "
>>>
>>> So you need a SetMode before.
>>>
>>> Jan
>>>
>>> Am 08.11.2015 um 09:04 schrieb Joseph Weidinger:
>>>
>>>> I am creating a new text expression definition (ted) and that part
>>>> works. However it won't assign the metakey "a" (which is 65 apparently)
>>>>
>>>> I try to do this:
>>>> ~ ted defined and working great
>>>>
>>>> local ma = finale.FCMetatoolAssignment()
>>>> ma:SaveAsKeystroke(65)
>>>> ma:SaveNew()
>>>> ma:AssignTextExpressionDef(ted)
>>>>
>>>> ted:SaveNew()
>>>>
>>>> Maybe it has something to do with set mode? I coculdn't get anything
>>>> to work. Help appreciated! Thanks.
>>>>
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> 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 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
>
>
>
> _______________________________________________
> 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/20151108/8276dbd6/attachment.htm>
More information about the JWLua
mailing list