[JW Lua] Create Staff

Chris marcel.denio at gmail.com
Wed May 7 18:52:17 CEST 2014


Hello Jari

I can duplicate a staff with SaveAs(), creating TextBlocks with methods 
"SaveNewFullNameString" and "SaveNewAbbreviatedNameString", it works.
But when I create a new staff, the methods "SaveNew" and "SaveAs" return 
false.


---------------------- DUPLICATE THE FIRST STAFF 
------------------------------------------
function firstFreeIndex()
     local staff = finale.FCStaff()
     local i = 0

     repeat
       i = i + 1
     until not staff:Load(i)

     return i
end

local staff = finale.FCStaff()
if staff:Load(1) then
    local strName =finale.FCString()
     strName.LuaString="full name"
     staff:SaveNewFullNameString (strName)
     local strAbrev =finale.FCString()
     strAbrev.LuaString="abrev"
     staff:SaveNewAbbreviatedNameString (strAbrev)

     staff:SaveAs(firstFreeIndex())

     local st = finale.FCSystemStaff()
     st.Staff= staff.ItemNo
     st.Distance = 300
     st.Resize = 100
     st:SaveNew(0)   -- Scroll View

     local staffsystems = finale.FCStaffSystems()
     staffsystems:LoadAll()

     for ss in each(staffsystems) do
         st:SaveNew(ss.ItemNo)
     end

end



-------------------------- CREATE A NEW STAFF 
-----------------------------------------------

local staff = finale.FCStaff()
staff.AltNotationDisplayOtherLayerNotes = true
staff.AltNotationLayer = 1
staff.AltNotationStyle =finale.ALTSTAFF_NORMAL
staff.FirstClef = 5
staff.HideMode = 0
staff.IgnoreKeySig = false
staff.IndependentKeySig = false
staff.IndependentTimeSig = false
staff.InstrumentUUID = finale.FFUUID_CLASSICALGUITAR
staff.LineCount = 5
staff.NotationStyle = finale.STAFFNOTATION_NORMAL
staff.ShowAugmentationDots = true
staff.ShowBarlines = true
staff.ShowChords = true
staff.ShowClefs = true
staff.ShowFretboards = true
staff.ShowKeySignatures = true
staff.ShowLyrics = true
staff.ShowMeasureNumbers = true
staff.ShowPartStaffNames = true
staff.ShowRepeats = true
staff.ShowRests = true
staff.ShowScoreStaffNames = true
staff.ShowStaffLines = true
staff.ShowStems = true
staff.ShowTextRepeats = true
staff.ShowTies = true
staff.ShowTimeSignatures = true
staff.TransposeAlteration = 0
staff.TransposeChromatic = false
staff.TransposeClefIndex = 0
staff.TransposeInterval = 0
staff.TransposeSimplifyKey = false
staff.TransposeUseClef = false

local strName =finale.FCString()
strName.LuaString="full name"
staff:SaveNewFullNameString (strName)
local strAbrev =finale.FCString()
strAbrev.LuaString="abrev"
staff:SaveNewAbbreviatedNameString (strAbrev)

print(staff:SaveNew())

local st = finale.FCSystemStaff()
st.Staff= staff.ItemNo
st.Distance = 500
st.Resize = 100
st:SaveNew(0)   -- Scroll View

local staffsystems = finale.FCStaffSystems()
staffsystems:LoadAll()
for ss in each(staffsystems) do
     st:SaveNew(ss.ItemNo)
end

------------------------------------------------------------------------------------

Thanking you in advance

Chris



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://jwmusic.nu/pipermail/jwlua_jwmusic.nu/attachments/20140507/1a87f134/attachment-0002.html>


More information about the JWLua mailing list