<div dir="ltr"><div class="gmail_default" style="font-family:verdana,sans-serif;color:rgb(68,68,68)">I try using this:</div><div class="gmail_default" style=""><font color="#444444" face="verdana, sans-serif">print("Descr.: ", txtExprDef:GetDescription() )</font><br></div><div class="gmail_default" style=""><font color="#444444" face="verdana, sans-serif"><br></font></div><div class="gmail_default" style=""><font color="#444444" face="verdana, sans-serif">to get the Description of an item in the "Miscelaneous" category, but get an error:</font></div><div class="gmail_default" style=""><font color="#444444" face="verdana, sans-serif">[string "--------..."]:43: bad argument #1 to 'GetDescription' (FCString expected, got table)<br></font></div><div class="gmail_default" style=""><font color="#444444" face="verdana, sans-serif"><br></font></div><div class="gmail_default" style=""><font color="#444444" face="verdana, sans-serif">I do not understand, why a get method needs an argument? Why is there a FCString parameter necessary? And how can I retrieve the value of the description field of a expression tool item?</font></div><div class="gmail_default" style=""><font color="#444444" face="verdana, sans-serif"><br></font></div><div class="gmail_default" style=""><font color="#444444" face="verdana, sans-serif">Thanks!</font></div><div class="gmail_extra"><div><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"></div></div></div></div></div></div></div></div></div>
<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
Thank you, Jan!<br>
<br>
That's actually exactely the way I try to get my fingers wet... but when<br>
getting to description, I get these examples:<br>
<br>
-- Process single item:<br>
local ted = finale.FCTextExpressionDef()<br>
if ted:Load(1) then<br>
-- ('argString' must be defined here)<br>
ted:GetDescription(argString) -- No return value<br>
end<br>
<br>
-- Process a collection of items:<br>
local textexpressiondefs = finale.FCTextExpressionDefs()<br>
textexpressiondefs:LoadAll()<br>
for ted in each(textexpressiondefs) do<br>
-- ('argString' must be defined here)<br>
ted:GetDescription(argString) -- No return value<br>
end<br>
textexpressiondefs:SaveAll()<br>
<br>
<br>
And I am confused, because GetDescription needs an argument, even though I<br>
need it to read what is there already... or how do I have to understand the<br>
"argString" usage?<br>
><br>
> Hi Robert,<br>
><br>
> Welcome to the list. As far as I know, there is no direct way to list all<br>
> expressions in a category (there would probably need to be a Class-Function<br>
> for something like that). The way to go forward is to load all<br>
> TextEpressionDefs and look at each one of them to see if it?s attached to<br>
> the Misc-category:<br>
><br>
> --------<br>
> function IsMiscCategory(inputExpressionDef)<br>
> local allCategories = finale.FCCategoryDefs()<br>
> allCategories:LoadAll()<br>
> for thisCategory in each(allCategories) do<br>
> if thisCategory.ID == inputExpressionDef.CategoryID then<br>
> local categoryName = thisCategory:CreateName()<br>
> print(categoryName.LuaString)<br>
> if categoryName.LuaString == "Miscellaneous" then return true end<br>
> end<br>
> end<br>
> return false<br>
> end -- function IsRehearsalCategory(inputExpression)<br>
><br>
> local miscExpressions = {}<br>
><br>
> -- This handles all TextExpression<br>
> -- In case you also need ShapeExpressions use<br>
> -- local exprdefs = finale.FCShapeExpressionDefs()<br>
> -- and repeat the process<br>
><br>
> local exprdefs = finale.FCTextExpressionDefs()<br>
> exprdefs:LoadAll()<br>
> for exprdef in each(exprdefs) do<br>
> if IsMiscCategory(exprdef) then<br>
> miscExpressions[#miscExpressions + 1] = exprdef.ItemNo<br>
> end<br>
> end<br>
><br>
> print(#miscExpressions) -- Number of all Misc Expressions<br>
> --------<br>
><br>
> I hope this helps.<br>
> All the best,<br>
><br>
><br>
> Bart Visser<br>
><br>
><br>
><br>
> > Op 8 mei 2016, om 18:37 heeft Robert Wildling <<a href="mailto:robertwildling@gmail.com">robertwildling@gmail.com</a>><br>
> het volgende geschreven:<br>
> ><br>
> > Hi,<br>
> ><br>
> > this is my first post and also my first day with JW Lua from a developer<br>
> point of view. Quite amazing, what can be done with it!<br>
> ><br>
> > Currently I would like to adapt the awesome DoubleStaffMMR Lua script<br>
> that is somewhere out the in the forums. Whenever this plugin is applied,<br>
> it creates one (and only one!) MultiMeasureRest number to a 2-staff-system<br>
> instruments, hiding the default settings (which make a MMR appear twice).<br>
> ><br>
> > The numbers are created as text expressions saved in the "Miscellaneous"<br>
> category. The disadvantage of this plugin is that it creates a number for<br>
> each measure, not checking whether a number already exists as a text<br>
> expression. So I would like to fetch all the data that can be found in the<br>
> "Miscellaneous" category, check against the "Description" field (where is<br>
> says "DoubleStaffMMR_[number]") and use the existing item, or only then<br>
> create a new item.<br>
> ><br>
> > That's the theory. Now for the practical part: How do I fetch all items<br>
> from the "Miscellaneous" category?<br>
> ><br>
> > Thanks for any tips!<br>
> ><br>
> > Greetings,<br>
> > Robert<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" rel="noreferrer" target="_blank">http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu</a><br>
><br>
> Thank you for your script, Bart Visser! That is extremly helpful!!!<br>
><br>
> At the moment I am struggeling with getting the text of the Description<br>
> field (of a Expression Tool item). The "JW Lua" Class Browser offers a<br>
> GetDescription(argString) method (without a return value?), but it<br>
> obviously needs a string to do something. Instead, I need to read and<br>
> return the Description in order to compare it to another string...<br>
><br>
> local str = finale.FCString()<br>
> str.LuaString = [a variable from somewhere else like "DoubleStaffMMR5"]<br>
><br>
> ... and now?<br>
><br>
> Any hint would be most welcome!<br>
> Thanks!<br>
><br>
><br>
><br>
> 2016-05-08 18:37 GMT+02:00 Robert Wildling <<a href="mailto:robertwildling@gmail.com">robertwildling@gmail.com</a>>:<br>
><br>
> > Hi,<br>
> ><br>
> > this is my first post and also my first day with JW Lua from a developer<br>
> > point of view. Quite amazing, what can be done with it!<br>
> ><br>
> > Currently I would like to adapt the awesome DoubleStaffMMR Lua script<br>
> that<br>
> > is somewhere out the in the forums. Whenever this plugin is applied, it<br>
> > creates one (and only one!) MultiMeasureRest number to a 2-staff-system<br>
> > instruments, hiding the default settings (which make a MMR appear twice).<br>
> ><br>
> > The numbers are created as text expressions saved in the "Miscellaneous"<br>
> > category. The disadvantage of this plugin is that it creates a number for<br>
> > each measure, not checking whether a number already exists as a text<br>
> > expression. So I would like to fetch all the data that can be found in<br>
> the<br>
> > "Miscellaneous" category, check against the "Description" field (where is<br>
> > says "DoubleStaffMMR_[number]") and use the existing item, or only then<br>
> > create a new item.<br>
> ><br>
> > That's the theory. Now for the practical part: How do I fetch all items<br>
> > from the "Miscellaneous" category?<br>
> ><br>
> > Thanks for any tips!<br>
> ><br>
> > Greetings,<br>
> > Robert<br>
> ><br>
> -------------- next part --------------<br>
> An HTML attachment was scrubbed...<br>
> URL: <<br>
> <a href="http://jwmusic.nu/pipermail/jwlua_jwmusic.nu/attachments/20160510/adb929a1/attachment-0001.html" rel="noreferrer" target="_blank">http://jwmusic.nu/pipermail/jwlua_jwmusic.nu/attachments/20160510/adb929a1/attachment-0001.html</a><br>
> ><br>
><br>
> ------------------------------<br>
><br>
> Message: 4<br>
> Date: Tue, 10 May 2016 10:55:08 +0200<br>
> From: Jan Angerm?ller <<a href="mailto:jan@angermueller.com">jan@angermueller.com</a>><br>
> To: "The JW Lua script plug-in." <<a href="mailto:jwlua@jwmusic.nu">jwlua@jwmusic.nu</a>><br>
> Subject: Re: [JW Lua] get all items of "Expression Tool"<br>
> Message-ID: <<a href="mailto:b9e7b7fc-913a-6809-9e29-493ff5af31a1@angermueller.com">b9e7b7fc-913a-6809-9e29-493ff5af31a1@angermueller.com</a>><br>
> Content-Type: text/plain; charset="windows-1252"; Format="flowed"<br>
><br>
> Hi Robert,<br>
><br>
> you should use the JW Lua class browser, the online class documentation<br>
> and the examples that Jari put on his website to find this out.<br>
><br>
> The online class documentation starts here:<br>
> <a href="http://www.finaletips.nu/frameworkref/annotated.html" rel="noreferrer" target="_blank">http://www.finaletips.nu/frameworkref/annotated.html</a><br>
> So you browse to FCTextExpressionDef and search for "Description" and<br>
> you will have your solution.<br>
><br>
> The same result can be found in the JW Lua class browser:<br>
> Go to FCTextExpressionDef and enter "Description" in the Properties<br>
> and/or Methods search fields. Then you'll even get a sample code.<br>
><br>
> Best,<br>
> Jan<br>
><br>
><br>
><br>
> Am 10.05.2016 um 10:44 schrieb Robert Wildling:<br>
> > Thank you for your script, Bart Visser! That is extremly helpful!!!<br>
> ><br>
> > At the moment I am struggeling with getting the text of the<br>
> > Description field (of a Expression Tool item). The "JW Lua" Class<br>
> > Browser offers a GetDescription(argString) method (without a return<br>
> > value?), but it obviously needs a string to do something. Instead, I<br>
> > need to read and return the Description in order to compare it to<br>
> > another string...<br>
> ><br>
> > local str = finale.FCString()<br>
> > str.LuaString = [a variable from somewhere else like "DoubleStaffMMR5"]<br>
> ><br>
> > ... and now?<br>
> ><br>
> > Any hint would be most welcome!<br>
> > Thanks!<br>
> ><br>
> ><br>
> ><br>
> ><br>
> ><br>
> ><br>
> ><br>
> > *Robert Wildling*<br>
> > G?llnergasse 19/30 || A-1030 Vienna<br>
> > ph: +43 676 6089613<br>
> > @: <a href="mailto:robertwildling@gmail.com">robertwildling@gmail.com</a> <mailto:<a href="mailto:robertwildling@gmail.com">robertwildling@gmail.com</a>><br>
> ><br>
> > 2016-05-08 18:37 GMT+02:00 Robert Wildling <<a href="mailto:robertwildling@gmail.com">robertwildling@gmail.com</a><br>
> > <mailto:<a href="mailto:robertwildling@gmail.com">robertwildling@gmail.com</a>>>:<br>
> ><br>
> > Hi,<br>
> ><br>
> > this is my first post and also my first day with JW Lua from a<br>
> > developer point of view. Quite amazing, what can be done with it!<br>
> ><br>
> > Currently I would like to adapt the awesome DoubleStaffMMR Lua<br>
> > script that is somewhere out the in the forums. Whenever this<br>
> > plugin is applied, it creates one (and only one!) MultiMeasureRest<br>
> > number to a 2-staff-system instruments, hiding the default<br>
> > settings (which make a MMR appear twice).<br>
> ><br>
> > The numbers are created as text expressions saved in the<br>
> > "Miscellaneous" category. The disadvantage of this plugin is that<br>
> > it creates a number for each measure, not checking whether a<br>
> > number already exists as a text expression. So I would like to<br>
> > fetch all the data that can be found in the "Miscellaneous"<br>
> > category, check against the "Description" field (where is says<br>
> > "DoubleStaffMMR_[number]") and use the existing item, or only then<br>
> > create a new item.<br>
> ><br>
> > That's the theory. Now for the practical part: How do I fetch all<br>
> > items from the "Miscellaneous" category?<br>
> ><br>
> > Thanks for any tips!<br>
> ><br>
> > Greetings,<br>
> > Robert<br>
> ><br>
> ><br>
> ><br>
> ><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" rel="noreferrer" target="_blank">http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu</a><br>
><br>
> -------------- next part --------------<br>
> An HTML attachment was scrubbed...<br>
> URL: <<br>
> <a href="http://jwmusic.nu/pipermail/jwlua_jwmusic.nu/attachments/20160510/a2be370f/attachment.html" rel="noreferrer" target="_blank">http://jwmusic.nu/pipermail/jwlua_jwmusic.nu/attachments/20160510/a2be370f/attachment.html</a><br>
> ><br>
><br>
> ------------------------------<br>
><br>
> Subject: Digest Footer<br>
><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" rel="noreferrer" target="_blank">http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu</a><br>
><br>
><br>
> ------------------------------<br>
><br>
> End of JWLua Digest, Vol 34, Issue 3<br>
> ************************************<br>
><br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <<a href="http://jwmusic.nu/pipermail/jwlua_jwmusic.nu/attachments/20160510/d317f1ea/attachment.html" rel="noreferrer" target="_blank">http://jwmusic.nu/pipermail/jwlua_jwmusic.nu/attachments/20160510/d317f1ea/attachment.html</a>><br>
<br>
------------------------------<br>
<br>
Subject: Digest Footer<br>
<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" rel="noreferrer" target="_blank">http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu</a><br>
<br>
<br>
------------------------------<br>
<br>
End of JWLua Digest, Vol 34, Issue 4<br>
************************************<br>
</blockquote></div><br></div></div>