[JW Lua] Creating a new expression category

Jan Angermüller jan at angermueller.com
Tue Jan 28 16:53:26 CET 2014


Hi Jari,

I am trying to create a new expression category,
but don't have success with saving it.

Apart from many other solutions I tried
this is the one that I most believe in ;-),
but it still doesn't work. "SaveNew()" returns false.



local catdef = finale.FCCategoryDef()
catdef:SetUserCreated(true)
local textfontinfo = catdef:CreateTextFontInfo()
local musicfontinfo = catdef:CreateTextFontInfo()
catdef:SetTextFontInfo(textfontinfo)
catdef:SetMusicFontInfo(musicfontinfo)

local textstr = finale.FCString()      -- Make category name
textstr.LuaString = "New Category"
catdef:SetName(textstr)

catdef:SetID(8)  -- first free category ID (1-7 are occupied with the 
default IDs)
if catdef:SaveNew() then
    print("Save successful:",catdef:CreateName().LuaString)
else print("Save not successful")
end


Any ideas ? Or is it not possible yet ?

I also tried it without the SetID because it says in the documentation
"the data will not save if the id is changed. " But still no save success.

And I also tried within the collection FCCategoryDefs(), but the collection
does not have an insert or add-function, so I think it can't be included
on this way.

Best,
Jan




More information about the JWLua mailing list