<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    I couldn't get it to work either.<br>
    The problem seems to be with expressions and articulations only.<br>
    When using <a class="el"
href="http://www.finaletips.nu/frameworkref/class_f_c_metatool_assignment.html#a066f55661ffa8c0866fb0a839e131355afdaea1bba27ffb31aa52f8132222720e"
      style="color: rgb(70, 101, 162); font-weight: bold;
      text-decoration: none; font-family: Roboto, sans-serif; font-size:
      14px; font-style: normal; font-variant: normal; letter-spacing:
      normal; line-height: 22px; orphans: auto; text-align: start;
      text-indent: 0px; text-transform: none; white-space: normal;
      widows: 1; word-spacing: 0px; -webkit-text-stroke-width: 0px;">MTOOLMODE_EXPRESSION</a>
    or  <span style="color: rgb(0, 0, 0); font-family: Roboto,
      sans-serif; font-size: 14px; font-style: normal; font-variant:
      normal; font-weight: normal; letter-spacing: normal; line-height:
      22px; orphans: auto; text-align: start; text-indent: 0px;
      text-transform: none; white-space: normal; widows: 1;
      word-spacing: 0px; -webkit-text-stroke-width: 0px; display: inline
      !important; float: none; background-color: rgb(249, 250, 252);"><span
        class="Apple-converted-space"></span></span><a class="el"
href="http://www.finaletips.nu/frameworkref/class_f_c_metatool_assignment.html#a066f55661ffa8c0866fb0a839e131355ae7835e68d5c68a82751f99afb983ed4d"
      style="color: rgb(70, 101, 162); font-weight: bold;
      text-decoration: none; font-family: Roboto, sans-serif; font-size:
      14px; font-style: normal; font-variant: normal; letter-spacing:
      normal; line-height: 22px; orphans: auto; text-align: start;
      text-indent: 0px; text-transform: none; white-space: normal;
      widows: 1; word-spacing: 0px; -webkit-text-stroke-width: 0px;">MTOOLMODE_ARTICULATION</a>
    FCMetatoolAssignment:CreateLinkedObject() always returned nil in my
    test cases. The other metatool assignment modes seem to work fine -
    or at least they return an object.<br>
    <br>
    Jan <br>
    <br>
    <div class="moz-cite-prefix">Am 12.11.2015 um 15:08 schrieb Joseph
      Weidinger:<br>
    </div>
    <blockquote
cite="mid:CAN8zVDkydh8WgY8-e+=NX1Jmjzapyf4H+7LB2EkE9DtsNSesVQ@mail.gmail.com"
      type="cite">
      <div dir="ltr">Jari, any advice on this? I still cannot get a
        metakey assigned, even after taking your advice into
        consideration. I made a bare minimum example that demonstrates
        what won't work on this. It SHOULD create a new text expression
        called "test" (which it does) and assign it to metakey "a"
        (which it does not)
        <div>---------------------------------------------------------------------------</div>
        <div>
          <div>local ted = finale.FCTextExpressionDef()</div>
          <div><br>
          </div>
          <div>-- actual text of expression</div>
          <div>expText = "test"</div>
          <div>stringObject = finale.FCString()</div>
          <div>stringObject.LuaString = "^fontTxt(Times New
            Roman,4096)^size(14)^nfx(1)" .. expText</div>
          <div>ted:SaveNewTextBlock(stringObject)</div>
          <div><br>
          </div>
          <div>-- put into expression category</div>
          <div>catdef = finale.FCCategoryDef()</div>
          <div>catdef:Load(4)</div>
          <div>ted:AssignToCategory(catdef)</div>
          <div><br>
          </div>
          <div>-- assign metakey "a"</div>
          <div>local ma = finale.FCMetatoolAssignment()</div>
          <div>ma:SetMode(finale.MTOOLMODE_EXPRESSION)</div>
          <div>ma:AssignTextExpressionDef(ted)</div>
          <div>ma:SaveAsKeystroke(65)</div>
          <div><br>
          </div>
          <div>ted:SaveNew()</div>
        </div>
        <div>------------------------------------------------------------------------------</div>
      </div>
      <div class="gmail_extra"><br>
        <div class="gmail_quote">On Sun, Nov 8, 2015 at 8:07 AM, Joseph
          Weidinger <span dir="ltr"><<a moz-do-not-send="true"
              href="mailto:jsphweid@gmail.com" target="_blank">jsphweid@gmail.com</a>></span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div dir="ltr">So I moved that above metatool assignment and
              wrapped a print around AssignTextExpressionDef. Still no
              metatool assignment but it *does* return true...</div>
            <div class="HOEnZb">
              <div class="h5">
                <div class="gmail_extra"><br>
                  <div class="gmail_quote">On Sun, Nov 8, 2015 at 7:55
                    AM, Jan Angermüller <span dir="ltr"><<a
                        moz-do-not-send="true"
                        href="mailto:jan@angermueller.com"
                        target="_blank"><a class="moz-txt-link-abbreviated" href="mailto:jan@angermueller.com">jan@angermueller.com</a></a>></span>
                    wrote:<br>
                    <blockquote class="gmail_quote" style="margin:0 0 0
                      .8ex;border-left:1px #ccc solid;padding-left:1ex">
                      <div bgcolor="#FFFFFF" text="#000000"> I haven't
                        tested it, but maybe call <span style="white-space:pre-wrap"></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 moz-do-not-send="true"
href="http://www.finaletips.nu/frameworkref/class_f_c_metatool_assignment.html#ab9c22e27b1d9d30357d5a8d63b775acb"
                          target="_blank">AssignTextExpressionDef</a>
                        return true ?
                        <div>
                          <div><br>
                            <br>
                            <br>
                            <div>Am 08.11.2015 um 14:39 schrieb Joseph
                              Weidinger:<br>
                            </div>
                            <blockquote 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 style="white-space:pre-wrap">        </span>local
                                    ted = finale.FCTextExpressionDef()</div>
                                  <div><br>
                                  </div>
                                  <div><span style="white-space:pre-wrap">        </span>--
                                    actual text</div>
                                  <div><span style="white-space:pre-wrap">        </span>stringObject

                                    = finale.FCString()</div>
                                  <div><span style="white-space:pre-wrap">        </span>stringObject.LuaString

                                    = "^fontTxt(Times New
                                    Roman,4096)^size(14)^nfx(1)" ..
                                    expressionText</div>
                                  <div><span style="white-space:pre-wrap">        </span>ted:SaveNewTextBlock(stringObject)</div>
                                  <div><br>
                                  </div>
                                  <div><span style="white-space:pre-wrap">        </span>--

                                    description</div>
                                  <div><span style="white-space:pre-wrap">        </span>local

                                    descriptionstr = finale.FCString()</div>
                                  <div><span style="white-space:pre-wrap">        </span>descriptionstr.LuaString

                                    = expressionText -- get it from
                                    userinput also, why not</div>
                                  <div><span style="white-space:pre-wrap">        </span>ted:SetDescription(descriptionstr)</div>
                                  <div><br>
                                  </div>
                                  <div><span style="white-space:pre-wrap">        </span>--
                                    put into which category?</div>
                                  <div><span style="white-space:pre-wrap">        </span>catdef
                                    = finale.FCCategoryDef()</div>
                                  <div><span style="white-space:pre-wrap">        </span>catdef:Load(4)

                                    -- 4 is expressions</div>
                                  <div><span style="white-space:pre-wrap">        </span>ted:AssignToCategory(catdef)</div>
                                  <div><br>
                                  </div>
                                  <div><span style="white-space:pre-wrap">        </span>--
                                    we will not use standard positioning</div>
                                  <div><span style="white-space:pre-wrap">        </span>ted:SetUseCategoryPos(false)</div>
                                  <div><br>
                                  </div>
                                  <div><span style="white-space:pre-wrap">        </span>--
                                    here is the positioning data</div>
                                  <div><span style="white-space:pre-wrap">        </span>ted:SetVerticalAlignmentPoint(finale.ALIGNVERT_ABOVE_STAFF_BASELINE_OR_ENTRY)</div>
                                  <div><span style="white-space:pre-wrap">        </span>ted:SetVerticalBaselineOffset(-26)</div>
                                  <div><span style="white-space:pre-wrap">        </span>ted:SetVerticalEntryOffset(36)</div>
                                  <div><span style="white-space:pre-wrap">        </span>ted:SetHorizontalJustification(finale.EXPRJUSTIFY_LEFT)</div>
                                  <div><span style="white-space:pre-wrap">        </span>ted:SetHorizontalAlignmentPoint(finale.ALIGNHORIZ_CLICKPOS)</div>
                                  <div><span style="white-space:pre-wrap">        </span>ted:SetHorizontalOffset(0)</div>
                                  <div><span style="white-space:pre-wrap">        </span>ted:SetBreakMMRest(false)</div>
                                  <div><br>
                                  </div>
                                  <div><br>
                                  </div>
                                  <div><span style="white-space:pre-wrap">        </span>local
                                    ma = finale.FCMetatoolAssignment()</div>
                                  <div><span style="white-space:pre-wrap">        </span>ma:SetMode(finale.MTOOLMODE_EXPRESSION)</div>
                                  <div><span style="white-space:pre-wrap">        </span>ma:AssignTextExpressionDef(ted)</div>
                                  <div><span style="white-space:pre-wrap">        </span>ma:SaveAsKeystroke(65)</div>
                                  <div><br>
                                  </div>
                                  <div><span style="white-space:pre-wrap">        </span>ted:SaveNew()</div>
                                  <div><br>
                                  </div>
                                  <div><span style="white-space:pre-wrap">        </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"><a class="moz-txt-link-abbreviated" href="mailto:jari.williamsson@mailbox.swipnet.se">jari.williamsson@mailbox.swipnet.se</a></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><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> As
                                        the online documentation says
                                        for AssignTextExpressionDef:<br>
                                      </span> "The mode for the object
                                      must be set to
                                      MTOOLMODE_EXPRESSION *in advance*.
                                      "
                                      <div>
                                        <div><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>
                                      <div> <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></fieldset>
                              <br>
                              <pre>_______________________________________________
JWLua mailing list
<a moz-do-not-send="true" href="mailto:JWLua@jwmusic.nu" target="_blank">JWLua@jwmusic.nu</a>
<a moz-do-not-send="true" href="http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu" target="_blank">http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu</a>
</pre>
                            </blockquote>
                            <br>
                          </div>
                        </div>
                      </div>
                      <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>
                    </blockquote>
                  </div>
                  <br>
                </div>
              </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>