<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    The Staff name is the (main) name of the staff.<br>
    If a staff has several instruments you might need FCInstrumentDef.<br>
    If the instrument changes you may also need to check staff styles
    with instrument changes.<br>
    <br>
    Jan<br>
    <br>
    <div class="moz-cite-prefix">Am 14.05.2016 um 13:09 schrieb Robert
      Wildling:<br>
    </div>
    <blockquote
cite="mid:CAM9gVwQKL9fHOEC-KGMnkOLZMeDeEmUX_k6wnCfMC_TZ0p5Cwg@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div class="gmail_default"
          style="font-family:verdana,sans-serif;color:rgb(68,68,68)">Hi,</div>
        <div class="gmail_default"
          style="font-family:verdana,sans-serif;color:rgb(68,68,68)"><br>
        </div>
        <div class="gmail_default"
          style="font-family:verdana,sans-serif;color:rgb(68,68,68)">a
          script loops over all staves of a score and logs some message
          to the console about found attributes, among them the staff's
          full name. But 2 weird things happen:</div>
        <div class="gmail_default"
          style="font-family:verdana,sans-serif;color:rgb(68,68,68)"><br>
        </div>
        <div class="gmail_default"
          style="font-family:verdana,sans-serif;color:rgb(68,68,68)">1.
          it lists empty entries and I have no idea, where they come
          from. In one case, there was an instrument change (and it
          seems this script cannot read a staff name of an instrument
          change staff...) and two others from a multi-staff instrument
          (harp). But still there are 5 more logs of staves that have no
          name and are not in the score. I even tried to DeepDelete
          them, but to no avail...</div>
        <div class="gmail_default"
          style="font-family:verdana,sans-serif;color:rgb(68,68,68)">Is
          it possible that Finale remembers staves that were in the
          score at some earlier stage, but were deleted via ScoreManager
          at a later point?</div>
        <div class="gmail_default"
          style="font-family:verdana,sans-serif;color:rgb(68,68,68)"><br>
        </div>
        <div class="gmail_default"
          style="font-family:verdana,sans-serif;color:rgb(68,68,68)">2.
          The function is called like this: loadStaves(30). Depending on
          whether there is an attribute sent along, the script decides
          if it should loop over all staves (id == nil ... LoadAll() ..
          ) or over the specific one ( Load(id) ). But the "found id"
          part of the script throws this error:</div>
        <div class="gmail_default"
          style="font-family:verdana,sans-serif;color:rgb(68,68,68)"><br>
        </div>
        <div class="gmail_default"
          style="font-family:verdana,sans-serif;color:rgb(68,68,68)">   
          -- This function and ..."]:41: attempt to call method 'Load'
          (a nil value)</div>
        <div class="gmail_default"
          style="font-family:verdana,sans-serif;color:rgb(68,68,68)"><br>
        </div>
        <div class="gmail_default"
          style="font-family:verdana,sans-serif;color:rgb(68,68,68)">According
          to the Class browser, though, the syntax is correct.
          Nevertheless, the Load method  will not even accept a number
          that is entered manually...</div>
        <div class="gmail_default"
          style="font-family:verdana,sans-serif;color:rgb(68,68,68)"><br>
        </div>
        <div class="gmail_default"
          style="font-family:verdana,sans-serif;color:rgb(68,68,68)">Any
          ideas what I am doing wrong here?</div>
        <div class="gmail_default"
          style="font-family:verdana,sans-serif;color:rgb(68,68,68)">Thanks!</div>
        <div class="gmail_default"
          style="font-family:verdana,sans-serif;color:rgb(68,68,68)">Robert</div>
        <div class="gmail_default"
          style="font-family:verdana,sans-serif;color:rgb(68,68,68)"><br>
        </div>
        <div class="gmail_default"
          style="font-family:verdana,sans-serif;color:rgb(68,68,68)"> </div>
        <div class="gmail_default"
          style="font-family:verdana,sans-serif;color:rgb(68,68,68)"><br>
        </div>
        <div class="gmail_default"
          style="font-family:verdana,sans-serif;color:rgb(68,68,68)">This
          is the script:</div>
        <div class="gmail_default"
          style="font-family:verdana,sans-serif;color:rgb(68,68,68)"><br>
        </div>
        <div class="gmail_default"
          style="font-family:verdana,sans-serif;color:rgb(68,68,68)">****************************</div>
        <div class="gmail_default" style="">
          <div class="gmail_default" style=""><font face="verdana,
              sans-serif" color="#444444">function loadStaves( id )</font></div>
          <div class="gmail_default" style=""><font face="verdana,
              sans-serif" color="#444444">    local staffNameFull =
              finale.FCString()</font></div>
          <div class="gmail_default" style=""><font face="verdana,
              sans-serif" color="#444444">    local staffNameAbbr =
              finale.FCString()</font></div>
          <div class="gmail_default" style=""><font face="verdana,
              sans-serif" color="#444444"><br>
            </font></div>
          <div class="gmail_default" style=""><font face="verdana,
              sans-serif" color="#444444">    if ( id == nil )  then </font></div>
          <div class="gmail_default" style=""><font face="verdana,
              sans-serif" color="#444444">        print ( "ID = not
              given, so get all staves")</font><span
              style="color:rgb(68,68,68);font-family:verdana,sans-serif">  </span></div>
          <div class="gmail_default" style=""><font face="verdana,
              sans-serif" color="#444444">        local staves =
              finale.FCStaves()</font></div>
          <div class="gmail_default" style=""><font face="verdana,
              sans-serif" color="#444444">        staves:LoadAll()</font></div>
          <div class="gmail_default" style=""><font face="verdana,
              sans-serif" color="#444444"><br>
            </font></div>
          <div class="gmail_default" style=""><font face="verdana,
              sans-serif" color="#444444">        for staff in
              each(staves) do</font></div>
          <div class="gmail_default" style=""><font face="verdana,
              sans-serif" color="#444444">            staffNameFull =
              staff:CreateTrimmedFullNameString()</font></div>
          <div class="gmail_default" style=""><font face="verdana,
              sans-serif" color="#444444">            staffNameAbbr =
              staff:CreateTrimmedAbbreviatedNameString()</font></div>
          <div class="gmail_default" style=""><font face="verdana,
              sans-serif" color="#444444">           </font></div>
          <div class="gmail_default" style=""><font face="verdana,
              sans-serif" color="#444444">            print("ItemNo: ",
              staff:GetItemNo(), </font></div>
          <div class="gmail_default" style=""><font face="verdana,
              sans-serif" color="#444444">                    " --->
              Staff name full: ", staffNameFull.LuaString, </font></div>
          <div class="gmail_default" style=""><font face="verdana,
              sans-serif" color="#444444">                    " - abbr:
              ", staffNameAbbr.LuaString</font></div>
          <div class="gmail_default" style=""><font face="verdana,
              sans-serif" color="#444444">            )</font></div>
          <div class="gmail_default" style=""><br>
          </div>
          <div class="gmail_default" style=""><font face="verdana,
              sans-serif" color="#444444">            if (
              staffNameFull.LuaString == "" </font></div>
          <div class="gmail_default" style=""><font face="verdana,
              sans-serif" color="#444444">                 and
              staffNameAbbr.LuaString == "" </font></div>
          <div class="gmail_default" style=""><font face="verdana,
              sans-serif" color="#444444">                 and
              staff:GetItemNo() == 30) </font></div>
          <div class="gmail_default" style=""><font face="verdana,
              sans-serif" color="#444444">            then</font></div>
          <div class="gmail_default" style=""><font face="verdana,
              sans-serif" color="#444444">                print("    
               empty... delete this... or not?");</font></div>
          <div class="gmail_default" style=""><font face="verdana,
              sans-serif" color="#444444">                local bool =
              staff:DeepDeleteData()</font></div>
          <div class="gmail_default" style=""><font face="verdana,
              sans-serif" color="#444444">                print(bool)</font></div>
          <div class="gmail_default" style=""><font face="verdana,
              sans-serif" color="#444444">               
              staves:SaveAll()</font></div>
          <div class="gmail_default" style=""><font face="verdana,
              sans-serif" color="#444444">            end</font></div>
          <div class="gmail_default" style=""><font face="verdana,
              sans-serif" color="#444444">        end</font></div>
          <div class="gmail_default" style=""><font face="verdana,
              sans-serif" color="#444444"><br>
            </font></div>
          <div class="gmail_default" style=""><font face="verdana,
              sans-serif" color="#444444">   else </font></div>
          <div class="gmail_default" style=""><font face="verdana,
              sans-serif" color="#444444">       print("ID = ", id, ",
              process only that staff, type = ", type(id))</font></div>
          <div class="gmail_default" style=""><span
              style="color:rgb(68,68,68);font-family:verdana,sans-serif"> 
                   local staff = finale.FCStaves();</span><br>
          </div>
          <div class="gmail_default" style=""><font face="verdana,
              sans-serif" color="#444444">       if staff:Load(id) then</font></div>
          <div class="gmail_default" style=""><font face="verdana,
              sans-serif" color="#444444">           staffNameFull =
              staff:CreateTrimmedFullNameString()</font></div>
          <div class="gmail_default" style=""><font face="verdana,
              sans-serif" color="#444444">           staffNameAbbr =
              staff:CreateTrimmedAbbreviatedNameString()</font></div>
          <div class="gmail_default" style=""><span
              style="color:rgb(68,68,68);font-family:verdana,sans-serif"> 
                       print("Staff name full: ",
              staffNameFull.LuaString, " - abbr: ",
              staffNameAbbr.LuaString )</span><br>
          </div>
          <div class="gmail_default" style=""><font face="verdana,
              sans-serif" color="#444444">        end</font></div>
          <div class="gmail_default" style=""><font face="verdana,
              sans-serif" color="#444444">    end</font></div>
          <div class="gmail_default" style=""><font face="verdana,
              sans-serif" color="#444444">end -- end function loadStaff</font></div>
          <div class="gmail_default" style=""><font face="verdana,
              sans-serif" color="#444444"><br>
            </font></div>
          <div class="gmail_default" style=""><font face="verdana,
              sans-serif" color="#444444">loadStaves(29)</font></div>
          <div class="gmail_default" style=""><font face="verdana,
              sans-serif" color="#444444">************************************</font></div>
        </div>
      </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>