<div dir="ltr"><div class="gmail_default" style="font-family:verdana,sans-serif;color:rgb(68,68,68)">Jan, thanks so much!</div><div class="gmail_default" style="font-family:verdana,sans-serif;color:rgb(68,68,68)"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;color:rgb(68,68,68)">I tried this script, it works without throwing an error - but also without the expected result. Is there probably a Save() command I am not aware of?</div><div class="gmail_default" style="font-family:verdana,sans-serif;color:rgb(68,68,68)"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;color:rgb(68,68,68)">----------------------</div><div class="gmail_default" style=""><div class="gmail_default" style=""><font color="#444444" face="verdana, sans-serif">function plugindef()</font></div><div class="gmail_default" style=""><font color="#444444" face="verdana, sans-serif"> -- Requires the creation of a new category "ZZZ_NOT_USED"; </font></div><div class="gmail_default" style=""><font color="#444444" face="verdana, sans-serif"> -- TODO: items (textExprDef) moved to that category could loose</font></div><div class="gmail_default" style=""><font color="#444444" face="verdana, sans-serif"> -- some aspects, if certain features of an item are available in the cateory</font></div><div class="gmail_default" style=""><font color="#444444" face="verdana, sans-serif"> finaleplugin.CategoryTags = "Expression"</font></div><div class="gmail_default" style=""><font color="#444444" face="verdana, sans-serif"> return "CreateUnusedCategory", "undoCreateUnusedCategory", "Create a category that will hold all unused elements"</font></div><div class="gmail_default" style=""><font color="#444444" face="verdana, sans-serif">end</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">-- Find category with name "ZZZ_NOT_USED"; needs to be created manually!</font></div><div class="gmail_default" style=""><font color="#444444" face="verdana, sans-serif">local catMoveToName = finale.FCString()</font></div><div class="gmail_default" style=""><font color="#444444" face="verdana, sans-serif">catMoveToName.LuaString = "ZZZ_NOT_USED"</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">-- Prepare the category, where unused elements will be moved to </font></div><div class="gmail_default" style=""><font color="#444444" face="verdana, sans-serif">-- (needs to be in the global namespace, not within a funcion! Therefore it is defined here.)</font></div><div class="gmail_default" style=""><font color="#444444" face="verdana, sans-serif">local moveToCat = finale.FCCategoryDef()</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">-- To do so, load all categories and seach for the Name string of the </font></div><div class="gmail_default" style=""><font color="#444444" face="verdana, sans-serif">local catNotUsed = finale.FCCategoryDefs()</font></div><div class="gmail_default" style=""><font color="#444444" face="verdana, sans-serif">catNotUsed:LoadAll()</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">for cd in each(catNotUsed) do</font></div><div class="gmail_default" style=""><font color="#444444" face="verdana, sans-serif"> local catName = cd:CreateName()</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"> -- if a category with the name "ZZZ_NOT_USED" is found, get its ID and load that very category</font></div><div class="gmail_default" style=""><font color="#444444" face="verdana, sans-serif"> if catName.LuaString == "ZZZ_NOT_USED" then</font></div><div class="gmail_default" style=""><font color="#444444" face="verdana, sans-serif"> local catID = cd:GetID()</font></div><div class="gmail_default" style=""><font color="#444444" face="verdana, sans-serif"> moveToCat:Load(catID)</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"> -- just for debugging purposes, get the name again and display it in the console</font></div><div class="gmail_default" style=""><font color="#444444" face="verdana, sans-serif"> local moveToCatName = moveToCat:CreateName()</font></div><div class="gmail_default" style=""><font color="#444444" face="verdana, sans-serif"> print("NAME: ", moveToCatName.LuaString)</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"> end</font></div><div class="gmail_default" style=""><font color="#444444" face="verdana, sans-serif">end</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">--local catMoveToItemNo = catNotUsed:FindName(catMoveToName) -- returns an object of type "userdata"</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">-- prepare some FCString variables</font></div><div class="gmail_default" style=""><font color="#444444" face="verdana, sans-serif">local tedName = finale.FCString()</font></div><div class="gmail_default" style=""><font color="#444444" face="verdana, sans-serif">local tedDescr = finale.FCString()</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">-- Now, get all textExpressionDefinitons</font></div><div class="gmail_default" style=""><font color="#444444" face="verdana, sans-serif">local textexpressiondefs = finale.FCTextExpressionDefs()</font></div><div class="gmail_default" style=""><font color="#444444" face="verdana, sans-serif">textexpressiondefs:LoadAll()</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">for ted in each(textexpressiondefs) do</font></div><div class="gmail_default" style=""><font color="#444444" face="verdana, sans-serif"> --get ItemNo of this txtExprDef</font></div><div class="gmail_default" style=""><font color="#444444" face="verdana, sans-serif"> local tedItemNo = ted:GetItemNo()</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"> -- get the Category ID to which this txtExprDef is assigned to</font></div><div class="gmail_default" style=""><font color="#444444" face="verdana, sans-serif"> local tedCatID = ted:GetCategoryID()</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"> -- based on the retrieved category ID, load that very category and retrieve its name (for debug display)</font></div><div class="gmail_default" style=""><font color="#444444" face="verdana, sans-serif"> local cat = finale.FCCategoryDef();</font></div><div class="gmail_default" style=""><font color="#444444" face="verdana, sans-serif"> cat:Load(tedCatID)</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"> local catName = finale.FCString()</font></div><div class="gmail_default" style=""><font color="#444444" face="verdana, sans-serif"> cat:GetName(catName)</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"> -- Just as a test, get all textExpreDef from the category test and move them to "ZZZ_NOT_USED"</font></div><div class="gmail_default" style=""><font color="#444444" face="verdana, sans-serif"> -- Later on there should be a check, whether any of these items it NOT in use in the score - but how??? TODO</font></div><div class="gmail_default" style=""><font color="#444444" face="verdana, sans-serif"> if catName.LuaString == "TEST" then</font></div><div class="gmail_default" style=""><font color="#444444" face="verdana, sans-serif"> --ted.AssignToCategory(moveToCat) -- not working; the online documentation says "FCCategoryDef expected", the error console "'AssignToCategory' (FCTextExpressionDef expected, got __FCBase)"</font></div><div class="gmail_default" style=""><font color="#444444" face="verdana, sans-serif"> print(moveToCat:GetID())</font></div><div class="gmail_default" style=""><font color="#444444" face="verdana, sans-serif"> ted:SetCategoryID(moveToCat:GetID())</font></div><div class="gmail_default" style=""><font color="#444444" face="verdana, sans-serif"> </font></div><div class="gmail_default" style=""><font color="#444444" face="verdana, sans-serif"> local descr = finale.FCString()</font></div><div class="gmail_default" style=""><font color="#444444" face="verdana, sans-serif"> descr.LuaString = "Moved Item"</font></div><div class="gmail_default" style=""><font color="#444444" face="verdana, sans-serif"> ted:SetDescription(descr);</font></div><div class="gmail_default" style=""><font color="#444444" face="verdana, sans-serif"> end</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">end</font></div></div><div class="gmail_default" style="font-family:verdana,sans-serif;color:rgb(68,68,68)"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;color:rgb(68,68,68)"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;color:rgb(68,68,68)"><br></div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><font size="2"><b><font color="#444444">Robert Wildling</font></b><font color="#666666"><br>Göllnergasse 19/30 || A-1030 Vienna</font></font></div><div><font size="2"><font color="#666666">ph: +43 676 6089613<br>@: <a href="mailto:robertwildling@gmail.com" target="_blank">robertwildling@gmail.com</a></font></font></div></div></div></div></div></div></div></div></div></div>
<br><div class="gmail_quote">2016-05-11 15:39 GMT+02:00 <span dir="ltr"><<a href="mailto:jwlua-request@jwmusic.nu" target="_blank">jwlua-request@jwmusic.nu</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Send JWLua mailing list submissions to<br>
<a href="mailto:jwlua@jwmusic.nu">jwlua@jwmusic.nu</a><br>
<br>
To subscribe or unsubscribe via the World Wide Web, visit<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>
or, via email, send a message with subject or body 'help' to<br>
<a href="mailto:jwlua-request@jwmusic.nu">jwlua-request@jwmusic.nu</a><br>
<br>
You can reach the person managing the list at<br>
<a href="mailto:jwlua-owner@jwmusic.nu">jwlua-owner@jwmusic.nu</a><br>
<br>
When replying, please edit your Subject line so it is more specific<br>
than "Re: Contents of JWLua digest..."<br>
<br>
<br>
Today's Topics:<br>
<br>
1. Creating a new Expression Category (Robert Wildling)<br>
2. Re: Creating a new Expression Category (Jan Angerm?ller)<br>
3. Re: FCStaffStyleDef:Load(...) always returns true (Chris)<br>
4. Re: Creating a new Expression Category (Robert Wildling)<br>
<br>
<br>
----------------------------------------------------------------------<br>
<br>
Message: 1<br>
Date: Wed, 11 May 2016 13:56:18 +0200<br>
From: Robert Wildling <<a href="mailto:robertwildling@gmail.com">robertwildling@gmail.com</a>><br>
To: <a href="mailto:jwlua@jwmusic.nu">jwlua@jwmusic.nu</a><br>
Subject: [JW Lua] Creating a new Expression Category<br>
Message-ID:<br>
<CAM9gVwSTQ8=DyuZotB6DmyYi-XQGO0-ZiWnz_02Z=NWwU=<a href="mailto:AJQQ@mail.gmail.com">AJQQ@mail.gmail.com</a>><br>
Content-Type: text/plain; charset="utf-8"<br>
<br>
Hi,<br>
<br>
I am looking for a way to create a new Expression Category withe the name<br>
of "unused" (the intention is to move all unused textExprDefs and<br>
ShaeexprDefs to that category).<br>
<br>
Starting out, I thought, this can only be done via selecting a specific<br>
category and saving it using "SaveAs" and a new "ItemNo", like this:<br>
<br>
``[lua]<br>
local dynCat = finale.FCCategoryDef()<br>
if dynCat:Load(2) then<br>
-- get the category name<br>
local catName = finale.FCString()<br>
dynCat:GetName(catName)<br>
<br>
-- save it anew<br>
dynCat:SaveNew()<br>
<br>
-- shows tha a new item number<br>
-- was generated (65535 ??? looks like an error...)<br>
print(dynCat:GetItemNo())<br>
end<br>
``<br>
<br>
But even though the category is assigned a new number (is 65535 an<br>
indicator for an error here? look strange), no new category was created.<br>
And if the ItemNo of the original category was changed, a second<br>
run-through shouldn't work, since Load(2) shouldn't find anything at that<br>
position... but it does...<br>
<br>
I am very confused... any hints and/or help would be much appreciated!<br>
Thanks!<br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <<a href="http://jwmusic.nu/pipermail/jwlua_jwmusic.nu/attachments/20160511/42fed95e/attachment-0001.html" rel="noreferrer" target="_blank">http://jwmusic.nu/pipermail/jwlua_jwmusic.nu/attachments/20160511/42fed95e/attachment-0001.html</a>><br>
<br>
------------------------------<br>
<br>
Message: 2<br>
Date: Wed, 11 May 2016 14:12:12 +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] Creating a new Expression Category<br>
Message-ID: <<a href="mailto:38d7462a-ddd4-cad8-5c30-7fb50fc2828c@angermueller.com">38d7462a-ddd4-cad8-5c30-7fb50fc2828c@angermueller.com</a>><br>
Content-Type: text/plain; charset="windows-1252"; Format="flowed"<br>
<br>
From the documentation<br>
<a href="http://www.finaletips.nu/frameworkref/class_f_c_category_def.html" rel="noreferrer" target="_blank">http://www.finaletips.nu/frameworkref/class_f_c_category_def.html</a>:<br>
<br>
"Please note that Finale does not allow plug-ins to create or delete<br>
category definitions."<br>
<br>
<br>
Am 11.05.2016 um 13:56 schrieb Robert Wildling:<br>
> Hi,<br>
><br>
> I am looking for a way to create a new Expression Category withe the<br>
> name of "unused" (the intention is to move all unused textExprDefs and<br>
> ShaeexprDefs to that category).<br>
><br>
> Starting out, I thought, this can only be done via selecting a<br>
> specific category and saving it using "SaveAs" and a new "ItemNo",<br>
> like this:<br>
><br>
> ``[lua]<br>
> local dynCat = finale.FCCategoryDef()<br>
> if dynCat:Load(2) then<br>
> -- get the category name<br>
> local catName = finale.FCString()<br>
> dynCat:GetName(catName)<br>
><br>
> -- save it anew<br>
> dynCat:SaveNew()<br>
><br>
> -- shows tha a new item number<br>
> -- was generated (65535 ??? looks like an error...)<br>
> print(dynCat:GetItemNo())<br>
> end<br>
> ``<br>
><br>
> But even though the category is assigned a new number (is 65535 an<br>
> indicator for an error here? look strange), no new category was<br>
> created. And if the ItemNo of the original category was changed, a<br>
> second run-through shouldn't work, since Load(2) shouldn't find<br>
> anything at that position... but it does...<br>
><br>
> I am very confused... any hints and/or help would be much appreciated!<br>
> Thanks!<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: <<a href="http://jwmusic.nu/pipermail/jwlua_jwmusic.nu/attachments/20160511/39d4b744/attachment-0001.html" rel="noreferrer" target="_blank">http://jwmusic.nu/pipermail/jwlua_jwmusic.nu/attachments/20160511/39d4b744/attachment-0001.html</a>><br>
<br>
------------------------------<br>
<br>
Message: 3<br>
Date: Wed, 11 May 2016 15:37:46 +0200<br>
From: Chris <<a href="mailto:marcel.denio@gmail.com">marcel.denio@gmail.com</a>><br>
To: <a href="mailto:jwlua@jwmusic.nu">jwlua@jwmusic.nu</a><br>
Subject: Re: [JW Lua] FCStaffStyleDef:Load(...) always returns true<br>
Message-ID: <<a href="mailto:57fc603d-4678-1507-c5e3-ea330daa3b16@gmail.com">57fc603d-4678-1507-c5e3-ea330daa3b16@gmail.com</a>><br>
Content-Type: text/plain; charset="utf-8"; Format="flowed"<br>
<br>
Hello Jan<br>
<br>
The problem is that the list index (ItemNo) is broken:<br>
1 2 3 4 5 6 7 8 9 10 .... 13 .... 20 ... 25 ......<br>
But why ???<br>
<br>
With this script, you retrieve the list (66 is your last index) :<br>
<br>
---------------------------------------------<br>
for i =1,66 do<br>
local namestr=finale.FCString()<br>
local s=finale.FCStaffStyleDef()<br>
s:Load(i)<br>
s:GetName(namestr)<br>
<br>
if namestr.LuaString=="" then<br>
local name = finale.FCString()<br>
name.LuaString = "dummy " .. i<br>
s:SetName(name)<br>
s:Save()<br>
end<br>
end<br>
---------------------------------------------<br>
<br>
Best regards<br>
<br>
Chris<br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <<a href="http://jwmusic.nu/pipermail/jwlua_jwmusic.nu/attachments/20160511/b214123e/attachment-0001.html" rel="noreferrer" target="_blank">http://jwmusic.nu/pipermail/jwlua_jwmusic.nu/attachments/20160511/b214123e/attachment-0001.html</a>><br>
<br>
------------------------------<br>
<br>
Message: 4<br>
Date: Wed, 11 May 2016 15:38:34 +0200<br>
From: Robert Wildling <<a href="mailto:robertwildling@gmail.com">robertwildling@gmail.com</a>><br>
To: <a href="mailto:jwlua@jwmusic.nu">jwlua@jwmusic.nu</a><br>
Subject: Re: [JW Lua] Creating a new Expression Category<br>
Message-ID:<br>
<CAM9gVwQx+AjmT_j091qYX8PXm7HtKJcW9Jw3-sTQFFU=<a href="mailto:n8Mp_g@mail.gmail.com">n8Mp_g@mail.gmail.com</a>><br>
Content-Type: text/plain; charset="utf-8"<br>
<br>
Thanks, Jan!<br>
<br>
(Why do I not receive an email, when you post your answer? hmmm...)<br>
<br>
Does this also mean that I cannot move around TextExpressionDefs from one<br>
Cat to another? Provided that I can check whether the item is used in the<br>
score or not (which I still didn't find the proper method for...)<br>
<br>
Best,<br>
Robert<br>
<br>
2016-05-11 13:56 GMT+02:00 Robert Wildling <<a href="mailto:robertwildling@gmail.com">robertwildling@gmail.com</a>>:<br>
<br>
> Hi,<br>
><br>
> I am looking for a way to create a new Expression Category withe the name<br>
> of "unused" (the intention is to move all unused textExprDefs and<br>
> ShaeexprDefs to that category).<br>
><br>
> Starting out, I thought, this can only be done via selecting a specific<br>
> category and saving it using "SaveAs" and a new "ItemNo", like this:<br>
><br>
> ``[lua]<br>
> local dynCat = finale.FCCategoryDef()<br>
> if dynCat:Load(2) then<br>
> -- get the category name<br>
> local catName = finale.FCString()<br>
> dynCat:GetName(catName)<br>
><br>
> -- save it anew<br>
> dynCat:SaveNew()<br>
><br>
> -- shows tha a new item number<br>
> -- was generated (65535 ??? looks like an error...)<br>
> print(dynCat:GetItemNo())<br>
> end<br>
> ``<br>
><br>
> But even though the category is assigned a new number (is 65535 an<br>
> indicator for an error here? look strange), no new category was created.<br>
> And if the ItemNo of the original category was changed, a second<br>
> run-through shouldn't work, since Load(2) shouldn't find anything at that<br>
> position... but it does...<br>
><br>
> I am very confused... any hints and/or help would be much appreciated!<br>
> Thanks!<br>
><br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <<a href="http://jwmusic.nu/pipermail/jwlua_jwmusic.nu/attachments/20160511/0d4f4d61/attachment.html" rel="noreferrer" target="_blank">http://jwmusic.nu/pipermail/jwlua_jwmusic.nu/attachments/20160511/0d4f4d61/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 11<br>
*************************************<br>
</blockquote></div><br></div>