<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
I haven't tested it, but maybe call <span class="" style="white-space:pre"></span>ted:SaveNew()
<b>before </b>assigning the metatool ?<br>
I am not sure, but the text expression might need "to be registered
in the system" before assigning the metatool.<br>
Does <a class="el"
href="http://www.finaletips.nu/frameworkref/class_f_c_metatool_assignment.html#ab9c22e27b1d9d30357d5a8d63b775acb">AssignTextExpressionDef</a>
return true ?<br>
<br>
<br>
<div class="moz-cite-prefix">Am 08.11.2015 um 14:39 schrieb Joseph
Weidinger:<br>
</div>
<blockquote
cite="mid:CAN8zVDn6++VDeq9W_mAyUQ=exXzKjNnpnCYkwLi=H4YcV0+XeQ@mail.gmail.com"
type="cite">
<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 moz-do-not-send="true"
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 moz-do-not-send="true"
href="mailto:JWLua@jwmusic.nu" target="_blank">JWLua@jwmusic.nu</a><br>
<a moz-do-not-send="true"
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 moz-do-not-send="true"
href="mailto:JWLua@jwmusic.nu" target="_blank">JWLua@jwmusic.nu</a><br>
<a moz-do-not-send="true"
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 moz-do-not-send="true" href="mailto:JWLua@jwmusic.nu"
target="_blank">JWLua@jwmusic.nu</a><br>
<a moz-do-not-send="true"
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>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
JWLua mailing list
<a class="moz-txt-link-abbreviated" href="mailto:JWLua@jwmusic.nu">JWLua@jwmusic.nu</a>
<a class="moz-txt-link-freetext" href="http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu">http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu</a>
</pre>
</blockquote>
<br>
</body>
</html>