[JW Lua] JWLua Digest, Vol 34, Issue 3

Jan Angermüller jan at angermueller.com
Tue May 10 11:17:58 CEST 2016


void FCTextExpressionDef::GetDescription 	( 	FCString 
<http://www.finaletips.nu/frameworkref/class_f_c_string.html> * 
/pDescriptionString/ 	) 	

 From the online documentation: "Gets the description text for the text 
expression definition."

As can be seen from the function declaration: the Get-function returns 
void, so it probably saves the return value into the FCString class. 
That's why it needs the string as a parameter.

local ted = finale.FCTextExpressionDef()
if ted:Load(1) then
    local argString=finale.FCString()
    ted:GetDescription(argString) -- No return value
    print(argString.LuaString)
end

  You should first study Jari's examples from 
http://jwmusic.nu/jwplugins/wiki/doku.php?id=jwlua:quickscripts . This 
should solve these questions.

Best,
Jan



Am 10.05.2016 um 11:02 schrieb Robert Wildling:
> Thank you, Jan!
>
> That's actually exactely the way I try to get my fingers wet... but 
> when getting to description, I get these examples:
>
> -- Process single item:
> local ted = finale.FCTextExpressionDef()
> if ted:Load(1) then
>    -- ('argString' must be defined here)
>    ted:GetDescription(argString) -- No return value
> end
>
> -- Process a collection of items:
> local textexpressiondefs = finale.FCTextExpressionDefs()
> textexpressiondefs:LoadAll()
> for ted in each(textexpressiondefs) do
>    -- ('argString' must be defined here)
>    ted:GetDescription(argString) -- No return value
> end
> textexpressiondefs:SaveAll()
>
>
> And I am confused, because GetDescription needs an argument, even 
> though I need it to read what is there already... or how do I have to 
> understand the "argString" usage?
>
>
>
> *Robert Wildling*
> Göllnergasse 19/30 || A-1030 Vienna
> ph: +43 676 6089613
> @: robertwildling at gmail.com <mailto:robertwildling at gmail.com>
>
> 2016-05-10 10:55 GMT+02:00 <jwlua-request at jwmusic.nu 
> <mailto:jwlua-request at jwmusic.nu>>:
>
>     Send JWLua mailing list submissions to
>     jwlua at jwmusic.nu <mailto: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 <mailto:jwlua-request at jwmusic.nu>
>
>     You can reach the person managing the list at
>     jwlua-owner at jwmusic.nu <mailto: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: get all items of "Expression Tool" (Bart Visser)
>        2. "Use Note Shapes" option ? (Jan Angerm?ller)
>        3. Re: get all items of "Expression Tool" (Robert Wildling)
>        4. Re: get all items of "Expression Tool" (Jan Angerm?ller)
>
>
>     ----------------------------------------------------------------------
>
>     Message: 1
>     Date: Mon, 09 May 2016 21:02:36 +0200
>     From: Bart Visser <bartvisser at me.com <mailto:bartvisser at me.com>>
>     To: "The JW Lua script plug-in." <jwlua at jwmusic.nu
>     <mailto:jwlua at jwmusic.nu>>
>     Subject: Re: [JW Lua] get all items of "Expression Tool"
>     Message-ID: <05A763D6-720D-4B82-BB3E-6371393939C4 at me.com
>     <mailto:05A763D6-720D-4B82-BB3E-6371393939C4 at me.com>>
>     Content-Type: text/plain; charset=utf-8
>
>     Hi Robert,
>
>     Welcome to the list. As far as I know, there is no direct way to
>     list all expressions in a category (there would probably need to
>     be a Class-Function for something like that). The way to go
>     forward is to load all TextEpressionDefs and look at each one of
>     them to see if it?s attached to the Misc-category:
>
>     --------
>     function IsMiscCategory(inputExpressionDef)
>       local allCategories = finale.FCCategoryDefs()
>       allCategories:LoadAll()
>       for thisCategory in each(allCategories) do
>         if thisCategory.ID == inputExpressionDef.CategoryID then
>           local categoryName = thisCategory:CreateName()
>           print(categoryName.LuaString)
>           if categoryName.LuaString == "Miscellaneous" then return
>     true end
>         end
>       end
>       return false
>     end -- function IsRehearsalCategory(inputExpression)
>
>     local miscExpressions = {}
>
>     -- This handles all TextExpression
>     -- In case you also need ShapeExpressions use
>     -- local exprdefs = finale.FCShapeExpressionDefs()
>     -- and repeat the process
>
>     local exprdefs = finale.FCTextExpressionDefs()
>     exprdefs:LoadAll()
>     for exprdef in each(exprdefs) do
>       if IsMiscCategory(exprdef) then
>             miscExpressions[#miscExpressions + 1] = exprdef.ItemNo
>       end
>     end
>
>     print(#miscExpressions) -- Number of all Misc Expressions
>     --------
>
>     I hope this helps.
>     All the best,
>
>
>     Bart Visser
>
>
>
>     > Op 8 mei 2016, om 18:37 heeft Robert Wildling
>     <robertwildling at gmail.com <mailto:robertwildling at gmail.com>> het
>     volgende geschreven:
>     >
>     > Hi,
>     >
>     > this is my first post and also my first day with JW Lua from a
>     developer point of view. Quite amazing, what can be done with it!
>     >
>     > Currently I would like to adapt the awesome DoubleStaffMMR Lua
>     script that is somewhere out the in the forums. Whenever this
>     plugin is applied, it creates one (and only one!) MultiMeasureRest
>     number to a 2-staff-system instruments, hiding the default
>     settings (which make a MMR appear twice).
>     >
>     > The numbers are created as text expressions saved in the
>     "Miscellaneous" category. The disadvantage of this plugin is that
>     it creates a number for each measure, not checking whether a
>     number already exists as a text expression. So I would like to
>     fetch all the data that can be found in the "Miscellaneous"
>     category, check against the "Description" field (where is says
>     "DoubleStaffMMR_[number]") and use the existing item, or only then
>     create a new item.
>     >
>     > That's the theory. Now for the practical part: How do I fetch
>     all items from the "Miscellaneous" category?
>     >
>     > Thanks for any tips!
>     >
>     > Greetings,
>     > Robert
>     > _______________________________________________
>     > JWLua mailing list
>     > JWLua at jwmusic.nu <mailto:JWLua at jwmusic.nu>
>     > http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu
>
>
>
>
>     ------------------------------
>
>     Message: 2
>     Date: Mon, 9 May 2016 21:39:31 +0200
>     From: Jan Angerm?ller <jan at angermueller.com
>     <mailto:jan at angermueller.com>>
>     To: "The JW Lua script plug-in." <jwlua at jwmusic.nu
>     <mailto:jwlua at jwmusic.nu>>
>     Subject: [JW Lua] "Use Note Shapes" option ?
>     Message-ID: <f9725493-e670-a460-d685-4c59d8545f62 at angermueller.com
>     <mailto:f9725493-e670-a460-d685-4c59d8545f62 at angermueller.com>>
>     Content-Type: text/plain; charset=utf-8; format=flowed
>
>     Jari (and all),
>
>     is the "Use Note Shapes" option from Document Options->Notes and Rests
>     with all its sub-parameters available yet ? I was asked for support of
>     scale degree noteheads. But it seems to be not possible yet.
>
>     Best,
>     Jan
>
>
>
>     ------------------------------
>
>     Message: 3
>     Date: Tue, 10 May 2016 10:44:41 +0200
>     From: Robert Wildling <robertwildling at gmail.com
>     <mailto:robertwildling at gmail.com>>
>     To: jwlua at jwmusic.nu <mailto:jwlua at jwmusic.nu>
>     Subject: Re: [JW Lua] get all items of "Expression Tool"
>     Message-ID:
>            
>     <CAM9gVwQnpsfam7bXxcW=g+4_wszO6qgSpfs5YhHe9_UeC1QVYQ at mail.gmail.com
>     <mailto:g%2B4_wszO6qgSpfs5YhHe9_UeC1QVYQ at mail.gmail.com>>
>     Content-Type: text/plain; charset="utf-8"
>
>     Thank you for your script, Bart Visser! That is extremly helpful!!!
>
>     At the moment I am struggeling with getting the text of the
>     Description
>     field (of a Expression Tool item). The "JW Lua" Class Browser offers a
>     GetDescription(argString) method (without a return value?), but it
>     obviously needs a string to do something. Instead, I need to read and
>     return the Description in order to compare it to another string...
>
>     local str = finale.FCString()
>     str.LuaString = [a variable from somewhere else like
>     "DoubleStaffMMR5"]
>
>     ... and now?
>
>     Any hint would be most welcome!
>     Thanks!
>
>
>
>
>
>
>
>     *Robert Wildling*
>     G?llnergasse 19/30 || A-1030 Vienna
>     ph: +43 676 6089613 <tel:%2B43%20676%206089613>
>     @: robertwildling at gmail.com <mailto:robertwildling at gmail.com>
>
>     2016-05-08 18:37 GMT+02:00 Robert Wildling
>     <robertwildling at gmail.com <mailto:robertwildling at gmail.com>>:
>
>     > Hi,
>     >
>     > this is my first post and also my first day with JW Lua from a
>     developer
>     > point of view. Quite amazing, what can be done with it!
>     >
>     > Currently I would like to adapt the awesome DoubleStaffMMR Lua
>     script that
>     > is somewhere out the in the forums. Whenever this plugin is
>     applied, it
>     > creates one (and only one!) MultiMeasureRest number to a
>     2-staff-system
>     > instruments, hiding the default settings (which make a MMR
>     appear twice).
>     >
>     > The numbers are created as text expressions saved in the
>     "Miscellaneous"
>     > category. The disadvantage of this plugin is that it creates a
>     number for
>     > each measure, not checking whether a number already exists as a text
>     > expression. So I would like to fetch all the data that can be
>     found in the
>     > "Miscellaneous" category, check against the "Description" field
>     (where is
>     > says "DoubleStaffMMR_[number]") and use the existing item, or
>     only then
>     > create a new item.
>     >
>     > That's the theory. Now for the practical part: How do I fetch
>     all items
>     > from the "Miscellaneous" category?
>     >
>     > Thanks for any tips!
>     >
>     > Greetings,
>     > Robert
>     >
>     -------------- next part --------------
>     An HTML attachment was scrubbed...
>     URL:
>     <http://jwmusic.nu/pipermail/jwlua_jwmusic.nu/attachments/20160510/adb929a1/attachment-0001.html>
>
>     ------------------------------
>
>     Message: 4
>     Date: Tue, 10 May 2016 10:55:08 +0200
>     From: Jan Angerm?ller <jan at angermueller.com
>     <mailto:jan at angermueller.com>>
>     To: "The JW Lua script plug-in." <jwlua at jwmusic.nu
>     <mailto:jwlua at jwmusic.nu>>
>     Subject: Re: [JW Lua] get all items of "Expression Tool"
>     Message-ID: <b9e7b7fc-913a-6809-9e29-493ff5af31a1 at angermueller.com
>     <mailto:b9e7b7fc-913a-6809-9e29-493ff5af31a1 at angermueller.com>>
>     Content-Type: text/plain; charset="windows-1252"; Format="flowed"
>
>     Hi Robert,
>
>     you should use the JW Lua class browser, the online class
>     documentation
>     and the examples that Jari put on his website to find this out.
>
>     The online class documentation starts here:
>     http://www.finaletips.nu/frameworkref/annotated.html
>     So you browse to FCTextExpressionDef and search for "Description" and
>     you will have your solution.
>
>     The same result can be found in the JW Lua class browser:
>     Go to FCTextExpressionDef and enter "Description" in the Properties
>     and/or Methods search fields. Then you'll even get a sample code.
>
>     Best,
>     Jan
>
>
>
>     Am 10.05.2016 um 10:44 schrieb Robert Wildling:
>     > Thank you for your script, Bart Visser! That is extremly helpful!!!
>     >
>     > At the moment I am struggeling with getting the text of the
>     > Description field (of a Expression Tool item). The "JW Lua" Class
>     > Browser offers a GetDescription(argString) method (without a return
>     > value?), but it obviously needs a string to do something. Instead, I
>     > need to read and return the Description in order to compare it to
>     > another string...
>     >
>     > local str = finale.FCString()
>     > str.LuaString = [a variable from somewhere else like
>     "DoubleStaffMMR5"]
>     >
>     > ... and now?
>     >
>     > Any hint would be most welcome!
>     > Thanks!
>     >
>     >
>     >
>     >
>     >
>     >
>     >
>     > *Robert Wildling*
>     > G?llnergasse 19/30 || A-1030 Vienna
>     > ph: +43 676 6089613
>     > @: robertwildling at gmail.com <mailto:robertwildling at gmail.com>
>     <mailto:robertwildling at gmail.com <mailto:robertwildling at gmail.com>>
>     >
>     > 2016-05-08 18:37 GMT+02:00 Robert Wildling
>     <robertwildling at gmail.com <mailto:robertwildling at gmail.com>
>     > <mailto:robertwildling at gmail.com
>     <mailto:robertwildling at gmail.com>>>:
>     >
>     >     Hi,
>     >
>     >     this is my first post and also my first day with JW Lua from a
>     >     developer point of view. Quite amazing, what can be done
>     with it!
>     >
>     >     Currently I would like to adapt the awesome DoubleStaffMMR Lua
>     >     script that is somewhere out the in the forums. Whenever this
>     >     plugin is applied, it creates one (and only one!)
>     MultiMeasureRest
>     >     number to a 2-staff-system instruments, hiding the default
>     >     settings (which make a MMR appear twice).
>     >
>     >     The numbers are created as text expressions saved in the
>     >     "Miscellaneous" category. The disadvantage of this plugin is
>     that
>     >     it creates a number for each measure, not checking whether a
>     >     number already exists as a text expression. So I would like to
>     >     fetch all the data that can be found in the "Miscellaneous"
>     >     category, check against the "Description" field (where is says
>     >     "DoubleStaffMMR_[number]") and use the existing item, or
>     only then
>     >     create a new item.
>     >
>     >     That's the theory. Now for the practical part: How do I
>     fetch all
>     >     items from the "Miscellaneous" category?
>     >
>     >     Thanks for any tips!
>     >
>     >     Greetings,
>     >     Robert
>     >
>     >
>     >
>     >
>     > _______________________________________________
>     > JWLua mailing list
>     > JWLua at jwmusic.nu <mailto: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/20160510/a2be370f/attachment.html>
>
>     ------------------------------
>
>     Subject: Digest Footer
>
>     _______________________________________________
>     JWLua mailing list
>     JWLua at jwmusic.nu <mailto:JWLua at jwmusic.nu>
>     http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu
>
>
>     ------------------------------
>
>     End of JWLua Digest, Vol 34, Issue 3
>     ************************************
>
>
>
>
> _______________________________________________
> 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/20160510/5d94554e/attachment.htm>


More information about the JWLua mailing list