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

Charles O. Lawrence charlesolawrence at bellsouth.net
Tue Nov 12 19:36:30 CET 2013


Bart,

I tried this code, but it did not trigger on the Title text like I expected
using the IsEnigmaFileInfoTitle method of the FCString class.  So I am
confused.  None of those IsEnigma tests seem to return true.  I reported
this in an earlier post to the list, but never got any answer.  Jari was
probably busy getting ready for the release of 2014.

local title_text = finale.FCFileInfoText()
title_text:LoadTitle()
local title = title_text:CreateString()
print(title.LuaString)
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	

Jari or someone else will have to set me straight.

Charles




-----Original Message-----
From: JWLua [mailto:jwlua-bounces at jwmusic.nu] On Behalf Of Bart Visser
Sent: Tuesday, November 12, 2013 11:12 AM
To: jwlua at jwmusic.nu
Subject: [JW Lua] Read FileInfoText + Display the value of variable

Hi all,

The page with sample-scripts contains a sample for setting the FileInfoText
(composer). I'm trying to read the FileInfo, but can't seem to find a way to
read the actual text into a variable. This is my code:

local title_text = finale.FCFileInfoText() result = title_text:LoadTitle()
--result: true (so something happens)
print(title_text) -- result: Userdata: 0x7964ddb2 (but I want to display the
actual title, say 'My Song')

I've looked at parent classes and other examples, but haven't found a
solution yet. Does anyone know what I'm doing wrong?

This all made me think: is there a Lua-variant of the Ruby 'inspect' method
(googled for it, but without succes)? While I was learning the Ruby language
I used it all the time so see what was happening in the background. Lua's
print()-function, for example, doesn't display the contents of a table, just
that something is a table. (or am I wrong?). I've used the
'dumpproperties(any_object)'-function, but some objects aren't suitable for
this kind of representation.

Thanks,


Bart Visser (who loves the direct and deep way JW Lua let's him interact
with a score. Thanks Jari!) _______________________________________________
JWLua mailing list
JWLua at jwmusic.nu
http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu





More information about the JWLua mailing list