[JW Lua] Using the FCNoteEntryLayer class

Jari Williamsson jari.williamsson at mailbox.swipnet.se
Thu Sep 12 23:27:03 CEST 2013


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
>






More information about the JWLua mailing list