<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 color="#444444" face="verdana, sans-serif">function loadStaves( id )</font></div><div class="gmail_default" style=""><font color="#444444" face="verdana, sans-serif"> local staffNameFull = finale.FCString()</font></div><div class="gmail_default" style=""><font color="#444444" face="verdana, sans-serif"> local staffNameAbbr = finale.FCString()</font></div><div class="gmail_default" style=""><font color="#444444" face="verdana, sans-serif"><br></font></div><div class="gmail_default" style=""><font color="#444444" face="verdana, sans-serif"> if ( id == nil ) then </font></div><div class="gmail_default" style=""><font color="#444444" face="verdana, sans-serif"> 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 color="#444444" face="verdana, sans-serif"> local staves = finale.FCStaves()</font></div><div class="gmail_default" style=""><font color="#444444" face="verdana, sans-serif"> staves:LoadAll()</font></div><div class="gmail_default" style=""><font color="#444444" face="verdana, sans-serif"><br></font></div><div class="gmail_default" style=""><font color="#444444" face="verdana, sans-serif"> for staff in each(staves) do</font></div><div class="gmail_default" style=""><font color="#444444" face="verdana, sans-serif"> staffNameFull = staff:CreateTrimmedFullNameString()</font></div><div class="gmail_default" style=""><font color="#444444" face="verdana, sans-serif"> staffNameAbbr = staff:CreateTrimmedAbbreviatedNameString()</font></div><div class="gmail_default" style=""><font color="#444444" face="verdana, sans-serif"> </font></div><div class="gmail_default" style=""><font color="#444444" face="verdana, sans-serif"> print("ItemNo: ", staff:GetItemNo(), </font></div><div class="gmail_default" style=""><font color="#444444" face="verdana, sans-serif"> " ---> Staff name full: ", staffNameFull.LuaString, </font></div><div class="gmail_default" style=""><font color="#444444" face="verdana, sans-serif"> " - abbr: ", staffNameAbbr.LuaString</font></div><div class="gmail_default" style=""><font color="#444444" face="verdana, sans-serif"> )</font></div><div class="gmail_default" style=""><br></div><div class="gmail_default" style=""><font color="#444444" face="verdana, sans-serif"> if ( staffNameFull.LuaString == "" </font></div><div class="gmail_default" style=""><font color="#444444" face="verdana, sans-serif"> and staffNameAbbr.LuaString == "" </font></div><div class="gmail_default" style=""><font color="#444444" face="verdana, sans-serif"> and staff:GetItemNo() == 30) </font></div><div class="gmail_default" style=""><font color="#444444" face="verdana, sans-serif"> then</font></div><div class="gmail_default" style=""><font color="#444444" face="verdana, sans-serif"> print(" empty... delete this... or not?");</font></div><div class="gmail_default" style=""><font color="#444444" face="verdana, sans-serif"> local bool = staff:DeepDeleteData()</font></div><div class="gmail_default" style=""><font color="#444444" face="verdana, sans-serif"> print(bool)</font></div><div class="gmail_default" style=""><font color="#444444" face="verdana, sans-serif"> staves:SaveAll()</font></div><div class="gmail_default" style=""><font color="#444444" face="verdana, sans-serif"> end</font></div><div class="gmail_default" style=""><font color="#444444" face="verdana, sans-serif"> end</font></div><div class="gmail_default" style=""><font color="#444444" face="verdana, sans-serif"><br></font></div><div class="gmail_default" style=""><font color="#444444" face="verdana, sans-serif"> else </font></div><div class="gmail_default" style=""><font color="#444444" face="verdana, sans-serif"> 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 color="#444444" face="verdana, sans-serif"> if staff:Load(id) then</font></div><div class="gmail_default" style=""><font color="#444444" face="verdana, sans-serif"> staffNameFull = staff:CreateTrimmedFullNameString()</font></div><div class="gmail_default" style=""><font color="#444444" face="verdana, sans-serif"> 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 color="#444444" face="verdana, sans-serif"> end</font></div><div class="gmail_default" style=""><font color="#444444" face="verdana, sans-serif"> end</font></div><div class="gmail_default" style=""><font color="#444444" face="verdana, sans-serif">end -- end function loadStaff</font></div><div class="gmail_default" style=""><font color="#444444" face="verdana, sans-serif"><br></font></div><div class="gmail_default" style=""><font color="#444444" face="verdana, sans-serif">loadStaves(29)</font></div><div class="gmail_default" style=""><font color="#444444" face="verdana, sans-serif">************************************</font></div></div><div><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"></div></div></div></div></div></div></div></div></div></div></div></div></div>
</div>