<div dir="ltr">Charles,<br><div><div><br>Thank you for the welcome!<br><br>I found it: you have to change the last line in:<br>newText:SaveNew(currentprocesspage)<br><br></div><div>Now I can go on...<br><br></div><div>Thanks,<br>
<br></div><div>Herbert<br></div><div><br></div></div></div><div class="gmail_extra"><br clear="all"><div><div dir="ltr">Hartelijke groet,<br><br>Herbert<br>(06-29455445)<br></div></div>
<br><br><div class="gmail_quote">2013/10/18 Charles O. Lawrence <span dir="ltr"><<a href="mailto:charlesolawrence@bellsouth.net" target="_blank">charlesolawrence@bellsouth.net</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div link="blue" vlink="purple" lang="EN-US"><div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Herbert,<u></u><u></u></span></p><p class="MsoNormal">
<span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Welcome aboard!  I have not tried this yet, but here is what I think you need to do.  Of course, Jari will set us straight.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">The PageAssignment does not specify which page you want your text on, but rather one of three settings 0->ALL pages, 1->ODD pages, or 2->EVEN pages.  To specify an individual page, you have to set BOTH FirstPage AND LastPage to the individual page number you want, or to a range of pages.  I haven’t figured out how to specify score or parts yet either.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">I will try it later, but I have to be away from my workstation right now.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Charles Lawrence<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:"Calibri","sans-serif"">From:</span></b><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""> JWLua [mailto:<a href="mailto:jwlua-bounces@jwmusic.nu" target="_blank">jwlua-bounces@jwmusic.nu</a>] <b>On Behalf Of </b>Herbert van Essen<br>
<b>Sent:</b> Friday, October 18, 2013 4:37 AM<br><b>To:</b> The JW Lua script plug-in.</span></p><div class="im"><br><b>Subject:</b> Re: [JW Lua] PageText not playing ball<u></u><u></u></div><p></p><p class="MsoNormal"><u></u> <u></u></p>
<div><div><div><div><div><div><div><div><p class="MsoNormal" style="margin-bottom:12.0pt">Hello Jari and all,<u></u><u></u></p></div><div><div class="h5"><p class="MsoNormal">I am following you since LUA started and now I am trying something myself.<u></u><u></u></p>
</div></div></div><div><div class="h5"><p class="MsoNormal">How about placing text on the page that is selected?<u></u><u></u></p></div></div></div><div><div class="h5"><p class="MsoNormal" style="margin-bottom:12.0pt">Or place text on many or all pages?<u></u><u></u></p>
</div></div></div><div><div class="h5"><p class="MsoNormal">Here is an example of placing text on a given page:<br><br>function plugindef()<br>   -- This function and the 'finaleplugin' namespace<br>   -- are both reserved for the plug-in definition.<br>
   finaleplugin.Author = "Herbert van Essen"<br>   finaleplugin.CategoryTags = "Text, Page, System, UI"<br>   return "Place text on page X", "Place text on page X",<br>           "Creates a predefined text on page X."<br>
end<br><br>-- Show user dialog box<br>local dialog = finenv.UserValueInput()<br>dialog.Title = "Place text"<br>dialog:SetTypes("Number")<br>dialog:SetDescriptions("page number:")<br>dialog:SetInitValues(1)<br>
local returnvalues = dialog:Execute()<br>if not returnvalues then return end<br><br><br>local currentprocesspage = returnvalues[1]<br><br>if currentprocesspage < 1 then<br>    print ("Input error: Invalid start page number.")<br>
    return <br>end<br><br>local pages = finale.FCPages()<br>local pageprocesscounter = 0<br><br>   -- Get the collection of PageText objects<br>local pageTexts = finale.FCPageTexts()<br><br>-- Create a new PageText object<br>
local newText = finale.FCPageText()<br>-- Here I'm wildly setting properties in case one of them is missing and essential!<br>newText.FirstPage = 0<br>newText.LastPage = 0<br>newText.PageAssignment = currentprocesspage<br>
newText.VerticalPos = -72<br>newText.HorizontalPos = 1<br>-- newText.HorizontalAlignment = 0 -- Calling this crashes Finale<br>newText.VerticalAlignment = 0<br>newText.PageEdgeRef = true<br><br>-- Create a new string object, set it to the desired text, with Enigma tags for font, size and nfx (whatever that is)<br>
local textObject = finale.FCString()<br>textObject:AppendLuaString("^font(Arial Black,4096)^size(24)^nfx(0)It Works!")<br><br>-- Set the string as the TextBlock on the new Page Text object (and check that it has via the console)<br>
print(newText:SaveNewTextBlock(textObject))<br><br>newText:SaveNew(1)<br> <u></u><u></u></p></div></div></div><div><div class="h5"><div><p class="MsoNormal">It doesn't work like that; Can you give me a hint to get this right?      <u></u><u></u></p>
</div><p class="MsoNormal">How can I get the PageAssignment to load at the currentprocesspage?<u></u><u></u></p></div></div></div><div><div class="h5"><div><p class="MsoNormal">And what are setting properties for? They are doing nothing as far as I can see.<u></u><u></u></p>
</div><div><p class="MsoNormal"><u></u> <u></u></p></div><p class="MsoNormal" style="margin-bottom:12.0pt">Thanks,<u></u><u></u></p></div></div></div><div><div class="h5"><p class="MsoNormal">Herbert <u></u><u></u></p><div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><br clear="all"><u></u><u></u></p><div><p class="MsoNormal">2013/10/17 Dave Foster <<a href="mailto:fozder@me.com" target="_blank">fozder@me.com</a>><u></u><u></u></p>
<blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in"><p class="MsoNormal">Hi Jari and all,<br><br>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:<br>
<br>-- Get the collection of PageText objects<br>local pageTexts = finale.FCPageTexts()<br><br>-- Create a new PageText object<br>local newText = finale.FCPageText()<br><br>-- Here I'm wildly setting properties in case one of them is missing and essential!<br>
newText.FirstPage = 1<br>newText.LastPage = 1<br>newText.VerticalPos = -72<br>newText.HorizontalPos = 1<br>-- newText.HorizontalAlignment = 0 -- Calling this crashes Finale<br>newText.VerticalAlignment = 0<br>newText.PageEdgeRef = true<br>
<br>-- Create a new string object, set it to the desired text, with Enigma tags for font, size and nfx (whatever that is)<br>local textObject = finale.FCString()<br>textObject:AppendLuaString("^font(Arial Black,4096)^size(24)^nfx(0)It Works!")<br>
<br>-- Set the string as the TextBlock on the new Page Text object (and check that it has via the console)<br>print(newText:SaveNewTextBlock(textObject))<br><br>newText:saveNew(1)<br><br>So I get the error<br><br>   -- This function and ..."]:41: attempt to call method 'saveNew' (a nil value)<br>
<br>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?<br><br>Cheers,<br><br>Dave<br><br><br>
<br>On 16 Oct 2013, at 11:00, <a href="mailto:jwlua-request@jwmusic.nu" target="_blank">jwlua-request@jwmusic.nu</a> wrote:<br><br>>> Next challenge - create some text - this doesn't seem to get anything to show up, either on the page or in the FCPageTexts:<br>
>><br>>> local newText = finale.FCPageText()<br>>> newText:SetFirstPage(1)<br>>> newText:SetLastPage(1)<br>>> newText:SetVerticalPos(-72)<br>>> newText:SetHorizontalPos(1)<br>>> local textObject = newText:CreateTextString()<br>
>> textObject:AppendLuaString("^font(Arial Black,4096)^size(24)^nfx(0)It Works!")<br>>> newText:SaveTextBlock(textObject)<br>>><br>>> Any thoughts?<br>><br>> 1. If you do "print(newText:SaveTextBlock(textObject))", you'll see that<br>
> it returns false. Replace "SaveTextBlock" with "SaveNewTextBlock". Since<br>> you're creating a new page text, you cannot replace a text pool item<br>> that doesn't exist. You should even be able to do "local textObject =<br>
> finale.FCString()" in this case as well, since "CreateTextString()" will<br>> never return any text.<br>> 2. After the Enigma text block has been saved, save the page text<br>> object. Add "newText:SaveNew(1)" at the end and the text will appear.<br>
<br><br>_______________________________________________<br>JWLua mailing list<br><a href="mailto:JWLua@jwmusic.nu" target="_blank">JWLua@jwmusic.nu</a><br><a href="http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu" target="_blank">http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu</a><u></u><u></u></p>
</blockquote></div><p class="MsoNormal"><u></u> <u></u></p></div></div></div></div></div></div><br>_______________________________________________<br>
JWLua mailing list<br>
<a href="mailto:JWLua@jwmusic.nu">JWLua@jwmusic.nu</a><br>
<a href="http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu" target="_blank">http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu</a><br>
<br></blockquote></div><br></div>