[JW Lua] Creating new text expression category

Simon Leclerc simon at prodsl.ca
Tue Jan 11 18:22:04 CET 2022


I can confirm the sample script shown below works fine for me,  using RGP Lua .58 on a Mac. This is a great addition to our toolbox to be able to create categories.

Simon Leclerc
Composer, conductor, arranger

> Le 11 janv. 2022 à 08:25, Robert Patterson <robert at robertgpatterson.com> a écrit :
> 
> 
> Also, I may have sent you early betas. Make sure you are using the actual released 0.58.
> 
>> On Tue, Jan 11, 2022 at 7:22 AM Robert Patterson <robert at robertgpatterson.com> wrote:
>> Your test script works for me. That error message sounds like you either are running the script on JW Lua or on an earlier version of RGP Lua. You can confirm the PDK version by adding this line to the beginning of your script:
>> 
>> finenv.UI():AlertNeutral("test", finenv.StringVersion)
>> 
>> When I run it, it displays "0.58".
>> 
>>> On Tue, Jan 11, 2022 at 6:41 AM Carl Vine <carlvine at iinet.net.au> wrote:
>>> I started off with “SaveNewWithType" in RGP0.58 which I noticed in your Class Browser, Robert, absent from JW’s original. And indeed started with the DEFAULTCATID_TECHNIQUETEXT type (“5”). But that method keeps throwing up the error: 'attempt to call method “SaveNewWithType” (a nil value).’
>>> 
>>> Here’s a basic test case:
>>> —  ============
>>> local new_cat = finale.FCCategoryDef()
>>> new_cat:Load(finale.DEFAULTCATID_TECHNIQUETEXT)
>>> local s = finale.FCString()
>>> s.LuaString = "Cue Names"
>>> new_cat:SetName(s)
>>> if new_cat:SaveNewWithType(finale.DEFAULTCATID_TECHNIQUETEXT) then
>>>       finenv.UI():AlertNeutral("test", "success")
>>> else
>>>       finenv.UI():AlertNeutral("test", "failure")
>>> end
>>> —  ============
>>> 
>>> Carl
>>> 
>>> > On 11 Jan 2022, at 10:00 pm, jwlua-request at jwmusic.nu wrote:
>>> > 
>>> > Send JWLua mailing list submissions to
>>> >       jwlua at jwmusic.nu
>>> > 
>>> > To subscribe or unsubscribe via the World Wide Web, visit
>>> >       http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu
>>> > or, via email, send a message with subject or body 'help' to
>>> >       jwlua-request at jwmusic.nu
>>> > 
>>> > You can reach the person managing the list at
>>> >       jwlua-owner at jwmusic.nu
>>> > 
>>> > When replying, please edit your Subject line so it is more specific
>>> > than "Re: Contents of JWLua digest..."
>>> > 
>>> > 
>>> > Today's Topics:
>>> > 
>>> >   1. Re: Creating new text expression category (Robert Patterson)
>>> >   2. Re: Creating new text expression category (Robert Patterson)
>>> >   3. Re: JWLua Digest, Vol 87, Issue 1 (Jacob Winkler)
>>> > 
>>> > 
>>> > ----------------------------------------------------------------------
>>> > 
>>> > Message: 1
>>> > Date: Mon, 10 Jan 2022 06:45:46 -0600
>>> > From: Robert Patterson <robert at robertgpatterson.com>
>>> > To: "The JW Lua script plug-in." <jwlua at jwmusic.nu>
>>> > Subject: Re: [JW Lua] Creating new text expression category
>>> > Message-ID:
>>> >       <CAACnceuPyULdeMMWvmNq+UkgkXkBx1iei0Fgq-zCY53YxgfYHw at mail.gmail.com>
>>> > Content-Type: text/plain; charset="utf-8"
>>> > 
>>> > SaveNewWithType should work in RGP Lua 0.58+. The others will not. If you
>>> > have an example of SaveNewWithType that fails to create a new category,
>>> > please post a sample script that fails.
>>> > 
>>> > However, creating a new category is just the beginning. To assign
>>> > expressions to it requires additional code for each expression.
>>> > 
>>> > 
>>> > On Mon, Jan 10, 2022 at 1:29 AM Carl Vine <carlvine at iinet.net.au> wrote:
>>> > 
>>> >> Can anyone help?
>>> >> 
>>> >> I?m loading the standard  TECHNIQUETEXT FCCategoryDef (ItemNo 5), changing
>>> >> the name and some values, then trying to Save() as a new category.
>>> >> 
>>> >> SaveNew(), SaveAs(new_unique_id) and SaveNewWithType(some_type) all fail.
>>> >> Save() succeeds but doesn?t change or update the CategoryDefs collection.
>>> >> 
>>> >> Carl
>>> >> 
>>> >> 
>>> >> _______________________________________________
>>> >> JWLua mailing list
>>> >> JWLua at jwmusic.nu
>>> >> http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu
>>> >> 
>>> > -------------- next part --------------
>>> > An HTML attachment was scrubbed...
>>> > URL: <http://jwmusic.nu/pipermail/jwlua_jwmusic.nu/attachments/20220110/bf516a7b/attachment-0001.html>
>>> > 
>>> > ------------------------------
>>> > 
>>> > Message: 2
>>> > Date: Mon, 10 Jan 2022 07:06:13 -0600
>>> > From: Robert Patterson <robert at robertgpatterson.com>
>>> > To: "The JW Lua script plug-in." <jwlua at jwmusic.nu>
>>> > Subject: Re: [JW Lua] Creating new text expression category
>>> > Message-ID:
>>> >       <CAACncet17Dt92LYNBRdEwCH=554v=P-uxXArpnNSAybG-AkyZg at mail.gmail.com>
>>> > Content-Type: text/plain; charset="utf-8"
>>> > 
>>> > Also, I just realized the documentation may not be clear. The "type" is not
>>> > just "some type". It must be one of the CATEGORY_DEDAULTIDS constants. In
>>> > your case, probably TECHNIQUETEXT.
>>> > 
>>> > On Mon, Jan 10, 2022 at 6:45 AM Robert Patterson <
>>> > robert at robertgpatterson.com> wrote:
>>> > 
>>> >> SaveNewWithType should work in RGP Lua 0.58+. The others will not. If you
>>> >> have an example of SaveNewWithType that fails to create a new category,
>>> >> please post a sample script that fails.
>>> >> 
>>> >> However, creating a new category is just the beginning. To assign
>>> >> expressions to it requires additional code for each expression.
>>> >> 
>>> >> 
>>> >> On Mon, Jan 10, 2022 at 1:29 AM Carl Vine <carlvine at iinet.net.au> wrote:
>>> >> 
>>> >>> Can anyone help?
>>> >>> 
>>> >>> I?m loading the standard  TECHNIQUETEXT FCCategoryDef (ItemNo 5),
>>> >>> changing the name and some values, then trying to Save() as a new category.
>>> >>> 
>>> >>> SaveNew(), SaveAs(new_unique_id) and SaveNewWithType(some_type) all fail.
>>> >>> Save() succeeds but doesn?t change or update the CategoryDefs collection.
>>> >>> 
>>> >>> Carl
>>> >>> 
>>> >>> 
>>> >>> _______________________________________________
>>> >>> JWLua mailing list
>>> >>> JWLua at jwmusic.nu
>>> >>> http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu
>>> >>> 
>>> >> 
>>> > -------------- next part --------------
>>> > An HTML attachment was scrubbed...
>>> > URL: <http://jwmusic.nu/pipermail/jwlua_jwmusic.nu/attachments/20220110/af23daad/attachment-0001.html>
>>> > 
>>> > ------------------------------
>>> > 
>>> > Message: 3
>>> > Date: Mon, 10 Jan 2022 07:32:23 -0800
>>> > From: Jacob Winkler <jacob.winkler at mac.com>
>>> > To: jwlua at jwmusic.nu
>>> > Subject: Re: [JW Lua] JWLua Digest, Vol 87, Issue 1
>>> > Message-ID: <3DD5BF11-3E50-4659-B4B4-4D5EE2CA7AE5 at mac.com>
>>> > Content-Type: text/plain; charset=utf-8
>>> > 
>>> > From my experience and understanding, you can access existing FCCategoryDefs along with their associated parameters, but you cannot create them. Perhaps this will change in the future with RGP Lua? I certainly would appreciate the addition as I?ve made several inelegant scripts that contain logic along the lines of ?if category x exists use it, else use miscellaneous ?.
>>> > 
>>> > Sent from my iPhone
>>> > 
>>> >> On Jan 10, 2022, at 3:00 AM, jwlua-request at jwmusic.nu wrote:
>>> >> 
>>> >> ?Send JWLua mailing list submissions to
>>> >>   jwlua at jwmusic.nu
>>> >> 
>>> >> To subscribe or unsubscribe via the World Wide Web, visit
>>> >>   http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu
>>> >> or, via email, send a message with subject or body 'help' to
>>> >>   jwlua-request at jwmusic.nu
>>> >> 
>>> >> You can reach the person managing the list at
>>> >>   jwlua-owner at jwmusic.nu
>>> >> 
>>> >> When replying, please edit your Subject line so it is more specific
>>> >> than "Re: Contents of JWLua digest..."
>>> >> 
>>> >> 
>>> >> Today's Topics:
>>> >> 
>>> >>  1. Creating new text expression category (Carl Vine)
>>> >> 
>>> >> 
>>> >> ----------------------------------------------------------------------
>>> >> 
>>> >> Message: 1
>>> >> Date: Mon, 10 Jan 2022 15:51:06 +1100
>>> >> From: Carl Vine <carlvine at iinet.net.au>
>>> >> To: jwlua at jwmusic.nu
>>> >> Subject: [JW Lua] Creating new text expression category
>>> >> Message-ID: <ED819027-5540-438E-B23C-FF57DB07B431 at iinet.net.au>
>>> >> Content-Type: text/plain;    charset=utf-8
>>> >> 
>>> >> Can anyone help?
>>> >> 
>>> >> I?m loading the standard  TECHNIQUETEXT FCCategoryDef (ItemNo 5), changing the name and some values, then trying to Save() as a new category.
>>> >> 
>>> >> SaveNew(), SaveAs(new_unique_id) and SaveNewWithType(some_type) all fail.
>>> >> Save() succeeds but doesn?t change or update the CategoryDefs collection.
>>> >> 
>>> >> Carl
>>> >> 
>>> >> 
>>> >> 
>>> >> 
>>> >> ------------------------------
>>> >> 
>>> >> Subject: Digest Footer
>>> >> 
>>> >> _______________________________________________
>>> >> JWLua mailing list
>>> >> JWLua at jwmusic.nu
>>> >> http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu
>>> >> 
>>> >> 
>>> >> ------------------------------
>>> >> 
>>> >> End of JWLua Digest, Vol 87, Issue 1
>>> >> ************************************
>>> > 
>>> > 
>>> > 
>>> > ------------------------------
>>> > 
>>> > Subject: Digest Footer
>>> > 
>>> > _______________________________________________
>>> > JWLua mailing list
>>> > JWLua at jwmusic.nu
>>> > http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu
>>> > 
>>> > 
>>> > ------------------------------
>>> > 
>>> > End of JWLua Digest, Vol 87, Issue 2
>>> > ************************************
>>> 
>>> 
>>> _______________________________________________
>>> JWLua mailing list
>>> JWLua at jwmusic.nu
>>> http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu
> _______________________________________________
> JWLua mailing list
> JWLua at jwmusic.nu
> http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://jwmusic.nu/pipermail/jwlua_jwmusic.nu/attachments/20220111/3d07f4da/attachment-0001.html>


More information about the JWLua mailing list