[JW Lua] FCPageTexts - Retrieve Item at a specific index

Jari Williamsson jari.williamsson at mailbox.swipnet.se
Sat Nov 29 18:02:27 CET 2014


Hello again Bruce,

I now see that you got a bad answer to your question.
Better answer is, use this pseudo code (rather than verifying cmper/inci 
stuff):

1. Load all available text blocks with LoadAll()
2. Iterate through all the text blocks with each()
3. If you find a text block you want to change in the iteration loop, 
change the properties and save the object with myobject:Save()
4. If you don't find the object you need in the collection/loop, create 
a new one. This new object will not be a part of the objects you 
previously loaded with LoadAll().



Best regards,

Jari Williamsson

On 2014-11-29 17:46, Jari Williamsson wrote:
> Bruce,
>
> You're correct about how the ItemCmper/ItemInci works in connection with
> FCPageText. However, you should rarely need to know that for most kind
> of script programming. :-)
>
> In your first message, you said you wanted to iterate through all the
> page text. This is done with something similar to:
> ---
> local pagetexts = finale.FCPageTexts()
> pagetexts:LoadAll()
> for ptext in each(pagetexts) do
>     local rawstr = ptext:CreateTextString()
>     print("First page:", ptext.FirstPage, "Last page:", ptext.LastPage,
> "Raw string:", rawstr.LuaString)
> end
> ---
>
> It's not possible to locate text block data in any pre-determined order.
> Data is added/removed as required in the order the user decides to do it.
>
>
> Best regards,
>
> Jari Williamsson
>
>
>
> On 2014-11-29 05:45, Bruce Olson wrote:
>> Hi Jari,
>>
>> I’ve been poking around in the list archives and found this reply from
>> you
>> in two messages to Charles:
>>
>> -- The record location for certain types of data. I added that so it
>> would
>> -- be possible to see the storage location on existing instances of
>> -- FCPageText, for example. ItemCmper would be the same as the value you
>> -- send to FCPageText:SaveNew(). ItemInci is the 0-based "record index"
>> -- within the ItemCmper.
>> -- In what scope? In the FCPageText scope, ItemCmper would be the page
>> -- number and ItemInci would be the subrecord number for objects
>> stored on
>> -- that page:
>> -- http://www.finaletips.nu/frameworkref/class_____f_c_inci_other.html
>>
>> This is getting me closer, but ItemCmper is the Page # only for single
>> page
>> items. It seems to be set to 0 for page ranges. Is that right? So that
>> leads
>> me to thinking that I should be using Load(<arguments>) to get a specific
>> one, but I haven't quite figured out what the syntax should be.
>>
>> --
>> Regards,
>> Bruce
>>
>> From: JWLua [mailto:jwlua-bounces at jwmusic.nu] On Behalf Of
>> Finale at web.yosound.com
>> Sent: Friday, November 28, 2014 3:03 PM
>> To: JWLua at jwmusic.nu
>> Subject: [JW Lua] FCPageTexts - Retrieve Item at a specific index
>>
>> Hi Jari,
>>
>> I am trying to iterate through all of the Page Text items in order to
>> either
>> update them or add them if they are missing in a document. This is in
>> order
>> to give a standard look to all the charts I write for my big band. I
>> think
>> what I should be using is GetItemAt, but am stuck trying to implement it.
>>
>> My process is to first iterate through all of them and modify a table
>> with a
>> flag to indicate that it exists by inserting an ID. I thought that
>> ItemCmper
>> and ItemInci were what I should use, but was wondering if there is an
>> easier
>> way.
>>
>>
>>
>> _______________________________________________
>> 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