<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
p
{mso-style-priority:99;
mso-margin-top-alt:auto;
margin-right:0in;
mso-margin-bottom-alt:auto;
margin-left:0in;
font-size:12.0pt;
font-family:"Times New Roman","serif";}
span.EmailStyle18
{mso-style-type:personal-reply;
font-family:"Calibri","sans-serif";
color:#1F497D;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri","sans-serif";}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Herbert,<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>I think Jari needs to explain what is going on here.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>If you specify FirstPage and LastPage as 0 like you did, then the SaveNew argument seems to be the page number where the text will be placed, as you say.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>However if the FirstPage and LastPage are set to a range, then the SaveNew argument seems to need to be 0. If FirstPage and LastPage are set to the same non-zero number, then the SaveNew argument seems to need to be that same number or 0.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>So, Jari, what is really going on here?!<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Charles<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></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:jwlua-bounces@jwmusic.nu] <b>On Behalf Of </b>Herbert van Essen<br><b>Sent:</b> Friday, October 18, 2013 10:11 AM<br><b>To:</b> The JW Lua script plug-in.<br><b>Subject:</b> Re: [JW Lua] PageText not playing ball<o:p></o:p></span></p><p class=MsoNormal><o:p> </o:p></p><div><p class=MsoNormal>Charles,<o:p></o:p></p><div><div><p class=MsoNormal style='margin-bottom:12.0pt'><br>Thank you for the welcome!<br><br>I found it: you have to change the last line in:<br>newText:SaveNew(currentprocesspage)<o:p></o:p></p></div><div><p class=MsoNormal style='margin-bottom:12.0pt'>Now I can go on...<o:p></o:p></p></div><div><p class=MsoNormal style='margin-bottom:12.0pt'>Thanks,<o:p></o:p></p></div><div><p class=MsoNormal>Herbert<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div></div></div><div><p class=MsoNormal><br clear=all><o:p></o:p></p><div><div><p class=MsoNormal>Hartelijke groet,<br><br>Herbert<br>(06-29455445)<o:p></o:p></p></div></div><p class=MsoNormal style='margin-bottom:12.0pt'><o:p> </o:p></p><div><p class=MsoNormal>2013/10/18 Charles O. Lawrence <<a href="mailto:charlesolawrence@bellsouth.net" target="_blank">charlesolawrence@bellsouth.net</a>><o:p></o:p></p><blockquote style='border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in'><div><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Herbert,</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'> </span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><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.</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'> </span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><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.</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'> </span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><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.</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'> </span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Charles Lawrence</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'> </span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'> </span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'> </span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'> </span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'> </span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><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><o:p></o:p></p><div><p class=MsoNormal><br><b>Subject:</b> Re: [JW Lua] PageText not playing ball<o:p></o:p></p></div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'> <o:p></o:p></p><div><div><div><div><div><div><div><div><p class=MsoNormal style='mso-margin-top-alt:auto;margin-bottom:12.0pt'>Hello Jari and all,<o:p></o:p></p></div><div><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>I am following you since LUA started and now I am trying something myself.<o:p></o:p></p></div></div></div><div><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>How about placing text on the page that is selected?<o:p></o:p></p></div></div></div><div><div><p class=MsoNormal style='mso-margin-top-alt:auto;margin-bottom:12.0pt'>Or place text on many or all pages?<o:p></o:p></p></div></div></div><div><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>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> <o:p></o:p></p></div></div></div><div><div><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>It doesn't work like that; Can you give me a hint to get this right? <o:p></o:p></p></div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>How can I get the PageAssignment to load at the currentprocesspage?<o:p></o:p></p></div></div></div><div><div><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>And what are setting properties for? They are doing nothing as far as I can see.<o:p></o:p></p></div><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'> <o:p></o:p></p></div><p class=MsoNormal style='mso-margin-top-alt:auto;margin-bottom:12.0pt'>Thanks,<o:p></o:p></p></div></div></div><div><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>Herbert <o:p></o:p></p><div><p class=MsoNormal style='mso-margin-top-alt:auto;margin-bottom:12.0pt'><br clear=all><o:p></o:p></p><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>2013/10/17 Dave Foster <<a href="mailto:fozder@me.com" target="_blank">fozder@me.com</a>><o:p></o:p></p><blockquote style='border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0in;margin-bottom:5.0pt'><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>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><o:p></o:p></p></blockquote></div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'> <o:p></o:p></p></div></div></div></div></div></div><p class=MsoNormal style='margin-bottom:12.0pt'><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><o:p></o:p></p></blockquote></div><p class=MsoNormal><o:p> </o:p></p></div></div></body></html>