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

Jari Williamsson jari.williamsson at mailbox.swipnet.se
Sat Nov 29 20:13:38 CET 2014


Bruce,

I can't reproduce that. If I load a default Finale document, add a few 
measures (so it spans 2 pages) with the following code:
---
local pagetexts = finale.FCPageTexts()
pagetexts:LoadAll()
for ptext in each(pagetexts) do
    local rawstr = ptext:CreateTextString()
    print("Cmper:" , ptext.ItemCmper, "Inci:", ptext.ItemInci)
end
---

I get the output:
---
Cmper: 0 Inci: 0
Cmper: 0 Inci: 1
Cmper: 1 Inci: 0
Cmper: 1 Inci: 1
Cmper: 1 Inci: 2
Cmper: 1 Inci: 3
---

If I then execute this code, the page number on page 2 is correctly 
marked to not show after execution:
---
local t = finale.FCPageText()
t:Load(0,0)
t.Visible = false
t:Save()
---


Best regards,

Jari Williamsson

On 2014-11-29 18:29, Bruce Olson wrote:
> Hi Jari,
>
> Yes, I tried that, but if  cmperno = 0 then you need to look at the
> FirstPage and use object:Load(FirstPage, incino) instead. Maybe that's a
> bug?
>
> --
> Regards,
> Bruce
>
>
> -----Original Message-----
> From: JWLua [mailto:jwlua-bounces at jwmusic.nu] On Behalf Of Jari Williamsson
> Sent: Saturday, November 29, 2014 11:13 AM
> To: The JW Lua script plug-in.
> Subject: Re: [JW Lua] FCPageTexts - Retrieve Item at a specific index
>
> Bruce,
>
> If you explicitly want to load a FCPageText object with a known
> cmperno/incino, use object:Load(cmperno, incino). That method is inherited
> from the __FCInciOther class.
>
> Best regards,
>
> Jari Williamsson
>
>
> On 2014-11-29 18:07, Bruce Olson wrote:
>> Jari,
>>
>> Thanks, the iterating through part I have. What I want to do is load a
>> specific FCPageText after I have once iterated through it. My first
>> pass using code like you posted below modifies a table with the
>> FirstPage and 5 other values.
>>
>> Then I loop through this table to see which rows are nil and which
>> were found. If it was found in the first pass then determine using
>> IsEnigmaFileInfoTitle() which one it is, and modify some values using
>> the data from a second table. If it was not found in the first pass,
>> then add it using the data from the second table. The second table is
>> in the same order as the first table.
>>
>> I hope that makes sense.
>>
>> --
>> Regards,
>> Bruce
>>
>> -----Original Message-----
>> From: JWLua [mailto:jwlua-bounces at jwmusic.nu] On Behalf Of Jari
>> Williamsson
>> Sent: Saturday, November 29, 2014 10:47 AM
>> To: The JW Lua script plug-in.
>> Subject: Re: [JW Lua] FCPageTexts - Retrieve Item at a specific index
>>
>> 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
>>
>>
>> _______________________________________________
>> 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