<div dir="ltr">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 (?).<div><br></div><div><div>function makeBoldAbove(expressionText)</div><div><span class="" style="white-space:pre">       </span>local ted = finale.FCTextExpressionDef()</div><div><br></div><div><span class="" style="white-space:pre">  </span>-- actual text</div><div><span class="" style="white-space:pre">     </span>stringObject = finale.FCString()</div><div><span class="" style="white-space:pre">   </span>stringObject.LuaString = "^fontTxt(Times New Roman,4096)^size(14)^nfx(1)" .. expressionText</div><div><span class="" style="white-space:pre">      </span>ted:SaveNewTextBlock(stringObject)</div><div><br></div><div><span class="" style="white-space:pre">        </span>-- description</div><div><span class="" style="white-space:pre">     </span>local descriptionstr = finale.FCString()</div><div><span class="" style="white-space:pre">   </span>descriptionstr.LuaString = expressionText -- get it from userinput also, why not</div><div><span class="" style="white-space:pre">   </span>ted:SetDescription(descriptionstr)</div><div><br></div><div><span class="" style="white-space:pre">        </span>-- put into which category?</div><div><span class="" style="white-space:pre">        </span>catdef = finale.FCCategoryDef()</div><div><span class="" style="white-space:pre">    </span>catdef:Load(4) -- 4 is expressions</div><div><span class="" style="white-space:pre"> </span>ted:AssignToCategory(catdef)</div><div><br></div><div><span class="" style="white-space:pre">      </span>-- we will not use standard positioning</div><div><span class="" style="white-space:pre">    </span>ted:SetUseCategoryPos(false)</div><div><br></div><div><span class="" style="white-space:pre">      </span>-- here is the positioning data</div><div><span class="" style="white-space:pre">    </span>ted:SetVerticalAlignmentPoint(finale.ALIGNVERT_ABOVE_STAFF_BASELINE_OR_ENTRY)</div><div><span class="" style="white-space:pre">      </span>ted:SetVerticalBaselineOffset(-26)</div><div><span class="" style="white-space:pre"> </span>ted:SetVerticalEntryOffset(36)</div><div><span class="" style="white-space:pre">     </span>ted:SetHorizontalJustification(finale.EXPRJUSTIFY_LEFT)</div><div><span class="" style="white-space:pre">    </span>ted:SetHorizontalAlignmentPoint(finale.ALIGNHORIZ_CLICKPOS)</div><div><span class="" style="white-space:pre">        </span>ted:SetHorizontalOffset(0)</div><div><span class="" style="white-space:pre"> </span>ted:SetBreakMMRest(false)</div><div><br></div><div><br></div><div><span class="" style="white-space:pre">        </span>local ma = finale.FCMetatoolAssignment()</div><div><span class="" style="white-space:pre">   </span>ma:SetMode(finale.MTOOLMODE_EXPRESSION)</div><div><span class="" style="white-space:pre">    </span>ma:AssignTextExpressionDef(ted)</div><div><span class="" style="white-space:pre">    </span>ma:SaveAsKeystroke(65)</div><div><br></div><div><span class="" style="white-space:pre">    </span>ted:SaveNew()</div><div><br></div><div><span class="" style="white-space:pre">     </span>return ted:GetItemNo()</div><div>end</div><div><br></div><div>local expressionID = makeBoldAbove("test") -- create it and get its new ID</div></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Nov 8, 2015 at 5:47 AM, Jari Williamsson <span dir="ltr"><<a href="mailto:jari.williamsson@mailbox.swipnet.se" target="_blank">jari.williamsson@mailbox.swipnet.se</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Joseph,<br>
<br>
In addition to what Jan said:<br>
* 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.<br>
<br>
* Put the AssignTextExpressionDef before the save, otherwise the connection to the text expression def will not be saved to Finale.<br>
<br>
<br>
Best regards,<br>
<br>
Jari Williamsson<span class=""><br>
<br>
On 2015-11-08 11:07, Jan Angermüller wrote:<br>
</span><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">
As the online documentation says for AssignTextExpressionDef:<br></span>
"The mode for the object must be set to MTOOLMODE_EXPRESSION *in advance*. "<div><div class="h5"><br>
So you need a SetMode before.<br>
<br>
Jan<br>
<br>
Am 08.11.2015 um 09:04 schrieb Joseph Weidinger:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I am creating a new text expression definition (ted) and that part<br>
works. However it won't assign the metakey "a" (which is 65 apparently)<br>
<br>
I try to do this:<br>
~ ted defined and working great<br>
<br>
local ma = finale.FCMetatoolAssignment()<br>
ma:SaveAsKeystroke(65)<br>
ma:SaveNew()<br>
ma:AssignTextExpressionDef(ted)<br>
<br>
ted:SaveNew()<br>
<br>
Maybe it has something to do with set mode? I coculdn't get anything<br>
to work. Help appreciated! Thanks.<br>
<br>
<br>
<br>
<br>
_______________________________________________<br>
JWLua mailing list<br>
<a href="mailto:JWLua@jwmusic.nu" target="_blank">JWLua@jwmusic.nu</a><br>
<a href="http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu" rel="noreferrer" target="_blank">http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu</a><br>
</blockquote>
<br>
<br>
<br>
_______________________________________________<br>
JWLua mailing list<br>
<a href="mailto:JWLua@jwmusic.nu" target="_blank">JWLua@jwmusic.nu</a><br>
<a href="http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu" rel="noreferrer" target="_blank">http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu</a><br>
<br>
</div></div></blockquote><div class="HOEnZb"><div class="h5">
<br>
<br>
<br>
_______________________________________________<br>
JWLua mailing list<br>
<a href="mailto:JWLua@jwmusic.nu" target="_blank">JWLua@jwmusic.nu</a><br>
<a href="http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu" rel="noreferrer" target="_blank">http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu</a><br>
</div></div></blockquote></div><br></div>