[JW Lua] Read FileInfoText + Display the value of variable

Charles O. Lawrence charlesolawrence at bellsouth.net
Wed Nov 13 18:44:55 CET 2013


Jari et al.,

After loading a couple of FCFileInfoText items in a new default document, I
tried to use FCPageTexts to read them back.  This thinking may be flawed,
but I thought they would be PageText items as well.  The below test script
shows nothing in the output for the title or composer.  I would expect to
see something within the parentheses in the Enigma Command Tags ^title() and
^composer().  What am I missing or getting mixing up and confused? 

Thanks,
Charles



local fileInfoText = finale.FCFileInfoText()
local str = finale.FCString()
local pageTexts = finale.FCPageTexts()

-- save Title and Composer in File Info text inserts

str.LuaString = "My Title is Scripter"
fileInfoText:SetText(str)
fileInfoText:SaveAsTitle()

str.LuaString = "My name is Charles"
fileInfoText:SetText(str)
fileInfoText:SaveAsComposer()

-- read back and display all page text on page

for pageTexts in loadall(finale.FCPageTexts()) do
    rawPageText = pageTexts:CreateTextString()
    print("Raw Page Text",rawPageText.LuaString)
        local enigmaStrings =rawPageText:CreateEnigmaStrings(true)
            for enigmaString in each(enigmaStrings) do
                print("\tEnigmaString ",enigmaString.LuaString)
                if enigmaString:IsEnigmaFileInfoTitle() then
                    print("\t\tFound an EnigmaFileInfoTitle")
                end
            end
        rawPageText:TrimEnigmaTags()
        print("Trimmed Raw Page Text >"..rawPageText.LuaString.."<")
end







More information about the JWLua mailing list