[JW Lua] PageText not playing ball
Charles O. Lawrence
charlesolawrence at bellsouth.net
Thu Oct 17 23:30:51 CEST 2013
Dave,
nfx (whatever that is)
I have discovered that ^nfx(a) is the "effects" or "Styles", in Finale
terms, applied to the text between the tag and any following tag, where a is
a decimal value for a bitmap of the effects. It is at least a byte value,
with the following bit values ( byte bit order -> 76543210):
0 - bold
1 - italics
2 - underlined
3 - ?
4 - ?
5 - strikeout
6 - ?
7 - hidden
For example, a value of 0 is plain, 1 is bold, 2 is italics, 3 is bold and
italics, etc. A real example would be ^nfx(1)Some^nfx(0) ^nfx(2)text^nfx(0)
^nfx(4)with^nfx(0) ^nfx(3)effects
Charles
-----Original Message-----
From: JWLua [mailto:jwlua-bounces at jwmusic.nu] On Behalf Of Dave Foster
Sent: Thursday, October 17, 2013 6:12 AM
To: jwlua at jwmusic.nu
Subject: [JW Lua] PageText not playing ball
Hi Jari and all,
Many thanks for your tips, especially on optimising my string concatenation
and using dot properties. I'm still struggling to get my new PageText object
to show up, either on screen or in the FCPageTexts collection - here's where
I'm at:
-- Get the collection of PageText objects local pageTexts =
finale.FCPageTexts()
-- Create a new PageText object
local newText = finale.FCPageText()
-- Here I'm wildly setting properties in case one of them is missing and
essential!
newText.FirstPage = 1
newText.LastPage = 1
newText.VerticalPos = -72
newText.HorizontalPos = 1
-- newText.HorizontalAlignment = 0 -- Calling this crashes Finale
newText.VerticalAlignment = 0 newText.PageEdgeRef = true
-- Create a new string object, set it to the desired text, with Enigma tags
for font, size and nfx (whatever that is) local textObject =
finale.FCString() textObject:AppendLuaString("^font(Arial
Black,4096)^size(24)^nfx(0)It Works!")
-- Set the string as the TextBlock on the new Page Text object (and check
that it has via the console)
print(newText:SaveNewTextBlock(textObject))
newText:saveNew(1)
So I get the error
-- This function and ..."]:41: attempt to call method 'saveNew' (a nil
value)
so looks like I'm not using saveNew() in the correct way - I've tried using
it on the collection (i.e. pageTexts:saveNew(newText)) but that's not it
either. Any ideas?
Cheers,
Dave
On 16 Oct 2013, at 11:00, jwlua-request at jwmusic.nu wrote:
>> Next challenge - create some text - this doesn't seem to get anything to
show up, either on the page or in the FCPageTexts:
>>
>> local newText = finale.FCPageText()
>> newText:SetFirstPage(1)
>> newText:SetLastPage(1)
>> newText:SetVerticalPos(-72)
>> newText:SetHorizontalPos(1)
>> local textObject = newText:CreateTextString()
>> textObject:AppendLuaString("^font(Arial Black,4096)^size(24)^nfx(0)It
>> Works!")
>> newText:SaveTextBlock(textObject)
>>
>> Any thoughts?
>
> 1. If you do "print(newText:SaveTextBlock(textObject))", you'll see
> that it returns false. Replace "SaveTextBlock" with
> "SaveNewTextBlock". Since you're creating a new page text, you cannot
> replace a text pool item that doesn't exist. You should even be able
> to do "local textObject = finale.FCString()" in this case as well,
> since "CreateTextString()" will never return any text.
> 2. After the Enigma text block has been saved, save the page text
> object. Add "newText:SaveNew(1)" at the end and the text will appear.
_______________________________________________
JWLua mailing list
JWLua at jwmusic.nu
http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu
More information about the JWLua
mailing list