[JW Lua] Using the FCNoteEntryLayer class

Charles O. Lawrence charlesolawrence at bellsouth.net
Fri Sep 13 01:24:03 CEST 2013


Thanks for the help.  It is "extremely simple" once you see what to do.  I
had gotten as far as creating the two different FCNoteEntryLayer objects and
Load(), but I did not realize you could just set the layer on the object.  I
was laboring with trying to clone the entries and had not gotten very far.
I was also under the mistaken notion that I would have to set the layer on
each of the note entries, since Load() loads the note entries.  The way you
manipulate things inside Finale is still somewhat of a mystery to me, but
I'll keep plodding along, one step at a time.

I am going to try each of the 3 options for working within a region.

BTW, when experimenting with this, I ran across what may be a bug/glitch in
the editor.  I had a multi-line comment that I had created by using a
construct like --[[.....]].  I collapsed the comment with the +/- button and
then deleted the resulting single line.  Running the script brought up
syntax errors on lines that were no longer available in the editor.  In
other words, line numbers were skipped, for example, 91,92,99,100.  The
errors occurred on lines between 92 and 99 which were no longer showing on
the editor, and there is no expand button anymore.  I have not tried this on
something like a for-end or if-end.

Charles Lawrence




-----Original Message-----
From: JWLua [mailto:jwlua-bounces at jwmusic.nu] On Behalf Of Jari Williamsson
Sent: Thursday, September 12, 2013 5:27 PM
To: The JW Lua script plug-in.
Subject: Re: [JW Lua] Using the FCNoteEntryLayer class

To swap layers, do like this:
1. Load both layers that should be swapped as 2 different FCNoteEntryLayer
objects 2. Swap the LayerIndex property for both 3. Save them back

The important thing with this approach is that there actually is a layer
swap. If you would change just one layer and resave to another layer, you'll
create a "layer mirror" that would behave very buggy in Finale.


As for only processing the region on cell boundaries, you have at least
3 options. Either work with the region boundaries directly, which I wouldn't
recommend unless for performance reasons (it's easy to create bugs with this
method).

The other approach is to use the eachcell() iterator and swap one cell at a
time, which would IMO give much easier-to-read code. eachcell() was
introduced in 0.03 but I forgot to document in the Wiki (this has now been
corrected).
http://jwmusic.nu/jwplugins/wiki/doku.php?id=jwlua:development&#eachcell

Another approach is to use FCCells:ApplyRegion() and then use the each()
iterator on all the cells. That would also result in swapping one cell at a
time.


Best regards,

Jari Williamsson


On 2013-09-12 22:47, Charles O. Lawrence wrote:
> So far this "extremely simple" process has eluded me.  I have spun my 
> wheels for hours on this and have not managed to do anything but make 
> either both layers disappear or put layer 1 into layer 2 (black notes 
> turn red) for the staff in the entire document.  I can't seem to see the
forest for the trees.
> I guess I'm going to have to give in and ask for more help (grin).  
> I'm sure CreateCloneEntries comes into play, but not being able to 
> figure out the why and how of many of the methods has left me nowhere.  
> The PDK docs are just a little too sketchy in explaining why you want 
> to use this or that method, and my knowledge of the innards of Finale is
very limited at this point.
> In addition, I want this to work only for the selected region, but the 
> methods that have regions as arguments seem to all return FCNoteEntry 
> objects/collections.  You indicated no other class was needed.  Maybe 
> it is for regions, I'm not sure at this point.
>
> I'm really getting a kick out of JWLua.  Keep it coming. Thanks, 
> Charles Lawrence
>
>
>
> -----Original Message-----
> From: JWLua [mailto:jwlua-bounces at jwmusic.nu] On Behalf Of Jari 
> Williamsson
> Sent: Wednesday, September 11, 2013 4:55 PM
> To: The JW Lua script plug-in.
> Subject: Re: [JW Lua] Using the FCNoteEntryLayer class
>
> The process to swap 2 layers is extremely simple in this case. You 
> don't need to use any iterators, and you don't need to access any 
> other class than FCNoteEntryLayer to do it. I think the only thing to 
> keep in mind is that for this class, the layer number is 0-based, called a
"LayerNumberIndex".
>
> The "storage buffer" you mention is actually the FCNoteEntryLayer class.
>
>
> Best regards,
>
> Jari Williamsson
>
>
> On 2013-09-11 22:43, Charles O. Lawrence wrote:
>> My goal in using this class is to swap the contents of two layers.
>> The class browser does not show any sample code for FCNoteEntryLayer.
>> Is there an iterator?  I want to work out the details for myself for 
>> learning purposes, so don't supply any code, but a few words on what 
>> you have to do to get started on this project would be helpful.
>> Conceptually, the task is simple enough.  One way would be to copy or 
>> clone layer "a" into a storage buffer of some kind, then move layer "b"
>> into layer "a", then move the buffer into layer "a".  I don't know if 
>> this idea is doable using the methods and properties of this class 
>> alone.  So far I am batting zero.  If I still don't get anywhere 
>> implementing any suggestions you may provide, I'll come back and ask 
>> for more detail.
>>
>> Thanks,
>>
>> Charles
>>
>>
>>
>> _______________________________________________
>> JWLua mailing list
>> JWLua at jwmusic.nu
>> http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu
>>
>
>
>
> _______________________________________________
> JWLua mailing list
> JWLua at jwmusic.nu
> http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu
>
>
> _______________________________________________
> JWLua mailing list
> JWLua at jwmusic.nu
> http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu
>



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





More information about the JWLua mailing list