[JW Lua] FCLuaIterator problem

Charles O. Lawrence charlesolawrence at bellsouth.net
Fri Dec 18 23:59:18 CET 2015


Is it because the only class ID documented is FCID_ARTICULATION?  If so, can
this be expanded to include all the other types of objects documented in the
ForEachObject() method?  Say yes, please.

I finally got it to work with this code using the ForEachSaved() method.  Is
there another, better way?

Sorry if the code is not formatted like it should be.  It looks good before
I send the email.  It's the Outlook that's munging it up, I think.
Charles
---------------------------------------------------------------------------
function callback(c)
   if c.ChordSuffixID == 27 then c.ChordSuffixID = 33 end
end
local chords = finale.FCChords()
chords:LoadAllForRegion(finenv.Region())
local iterator = finale.FCLuaIterator()
print(iterator:ForEachSaved(chords,callback))

-----Original Message-----
From: JWLua [mailto:jwlua-bounces at jwmusic.nu] On Behalf Of Charles O.
Lawrence
Sent: Thursday, December 17, 2015 11:38 AM
To: 'The JW Lua script plug-in.' <jwlua at jwmusic.nu>
Subject: [JW Lua] FCLuaIterator problem

Jari,

The following code always crashes Finale hard, so that a reboot is usually
necessary to get any control back.

Am I missing something, or is there a problem with the iterator?

I am trying to "improve" on the working code of HaraldS by replacing the
"deprecated" for..each()..do..end code with the newer FCLuaIterator().

Thanks,
Charles

------------------------------------------------------------------------
function callback(c)
   if c.ChordSuffixID == 27 then c.ChordSuffixID = 33 end end local iterator
= finale.FCLuaIterator()
iterator:ForEachRegionObjectSaved(finenv.Region(),finale.FCID_CHORD,callback
)

--[[ original code by HaraldS
local chords = finale.FCChords()
local n = chords:LoadAllForRegion(finenv.Region())
for c in each(chords) do
   if c.ChordSuffixID == 27 then c.ChordSuffixID = 33 end end
chords:SaveAll()
--]]


_______________________________________________
JWLua mailing list
JWLua at jwmusic.nu
http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu





More information about the JWLua mailing list