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

Jari Williamsson jari.williamsson at mailbox.swipnet.se
Tue Nov 12 20:32:47 CET 2013


Trying to answer both Bart and Charles in the same reply:

> local title_text = finale.FCFileInfoText()
> title_text:LoadTitle()
> local title = title_text:CreateString()
> print(title.LuaString)

Bart: These 4 lines are correct to get the File Info text for the 
"Title" field and print it. In the case of File Info text, you might 
want to clean the string with "title:TrimEnigmaTags()" as well, 
specially if you're saving it back to Finale.

> local enigmaStrings = title:CreateEnigmaStrings(true)
> 	for enigmaString in each(enigmaStrings) do
>                       print(enigmaString.LuaString)
>                       print(enigmaString:IsEnigmaFileInfoTitle())
>                       if enigmaString:IsEnigmaFileInfoTitle() then
>                             print(enigmaString.LuaString)
>                       end
>                end	

Charles: FCString::IsEnigmaFileInfoTitle() would check if the substring 
is the "^title()" Enigma command, which would never exist in File Info text.

Btw, if you use "print(myvar)" and you get the "UserData: 
0xsome_hex_number" output, you'll know it's a JW Lua class. In these 
cases, use "print(myvar:ClassName())" to get the JW Lua class.


Best regards,

Jari Williamsson





More information about the JWLua mailing list