[JW Lua] Changing noteheads in FCPercussionLayoutNotes problem ... cont'd

Jan Angermüller jan at angermueller.com
Tue Dec 1 16:17:24 CET 2015


Jari,

yes, this script will reproduce the issue that I described in the very 
first mail at the bottom. I.e. after running the script I need to press 
Undo and the Redo then it shows the right noteheads (tested today in v.44)
Pressing Ctrl-D as described in the mail from this week doesn't work in 
this script.
But I assume that if you solve the undo problem in this script, it will 
also make the other script with Ctrl-D work.

You need a percussion staff with a selected percussion map (not set to 
"Built in GM" !) and a percussion layout. On the staff you need any 
standard quarter note (see "ClosedNotehead" below).
After running the script the quarter notehead should have become an "x" 
notehead.

Here it is again with copy&paste compatibility:

local percstaff=finale.FCStaff()
finenv.Region():SetFullDocument()
percstaff:Load(finenv.Region().StartStaff)
if percstaff:IsPercussion() then
     local perclayoutID = percstaff:CalcPercussionLayoutID()
     local perclayout=finale.FCPercussionLayoutNotes()
     perclayout:LoadAllForItem(perclayoutID)
     if perclayout~=nil then
         for layoutnote in each(perclayout) do
             layoutnote:SetClosedNotehead(string.byte("x"))
             layoutnote:Save()
         end
     end
end

Jan





Am 01.12.2015 um 16:00 schrieb Jari Williamsson:
> Jan,
>
> Just to make sure I get this issue correctly: Will the script that you 
> posted in this e-mail chain reproduce the issue?
>
>
> Best regards,
>
> Jari Williamsson
>
> On 2015-11-30 18:20, Jan Angermüller wrote:
>> Jari,
>>
>> the new finenv.UI():MenuCommand(finale.MENUCMD_REDRAWSCREEN) and also
>> other combinations with RedrawDocument() or FCPage:UpdateLayout() didn't
>> solve the problem.
>> I still need to press Ctrl+D or do any other step that updates the
>> screen to get the correct percussion noteheads after running the plugin.
>>
>> Maybe there is an internal update flag that nees to be set for the
>> percussion noteheads ?
>>
>> Jan
>>
>> Am 26.11.2015 um 15:40 schrieb Jan Angermüller:
>>> Jari,
>>>
>>> I am still struggling with this problem (changing percussion
>>> noteheads, see description below in the mail from April). In a
>>> modified script dragging the screen (mouse+right button) or pressing
>>> Ctrl+D (Redraw Screen) after running the script now solves the
>>> problem. In the old script below dragging or Ctrl+D didn't solve the
>>> problem.
>>> But I found no solution that the script itself delivers the right 
>>> output.
>>>
>>> Even if I put
>>> finenv.UI():RedrawDocument()
>>> at the end of the script, it doesn't change anything. The percussion
>>> noteheads still looked messed up.
>>> Is there a difference between finenv.UI():RedrawDocument()at the end
>>> of the script and pressing Ctrl+D after running the plug-in ?
>>> Would it be possible to add the menu command MENUCMD_REDRAWDOCUMENT to
>>> achieve the same behaviour ?
>>> Attached is another screenshot of how the percussion noteheads that
>>> were changed from asci coding to SMuFl look right after running the
>>> plug-in and then (correct) after pressing Ctrl-D.
>>>
>>> Jan
>>>
>>> Am 02.04.2015 um 19:28 schrieb Jan Angermüller:
>>>> Jari,
>>>>
>>>> when changing the notehead symbols in a percussion layout,
>>>> I have the problem that the noteheads are changed in the
>>>> percussion layout table, but not automatically updated in the score.
>>>>
>>>> Now the strange thing: when I press "Undo" and then "Re-do" after
>>>> running the script, the changed noteheads appear in the score.
>>>> It seems to me that there is an update function missing internally
>>>> in JW Lua that the Finale Re-do function seems to call.
>>>>
>>>> See script below and this youtube screencam video
>>>> which demonstrates the behaviour in realtime: 
>>>> http://youtu.be/_Oo4fLq7qiE
>>>> In the video I first show how the percussion layout looks before,
>>>> then I run the script, then I undo and re-do it. Then the changed x
>>>> noteheads appear.
>>>>
>>>> They also do appear when I open the percussion layout dialog after
>>>> running the script
>>>> and click on ok without changing anything. Clicking ok applies the
>>>> selected percussion layout once more.
>>>> Simply pressing on CTRL-U or CTRL-D doesn't help.
>>>>
>>>> Any clues what might be wrong here ?
>>>>
>>>> Best regards,
>>>> Jan
>>>>
>>>> To run the script, *f**irst select a percussion staff* *with a
>>>> percussion layout attached *(i.e. a staff that is set to "Notation
>>>> Style: Percussion"):
>>>>
>>>> local percstaff=finale.FCStaff()
>>>> percstaff:Load(finenv.Region().StartStaff) --load selected percussion
>>>> staff
>>>> if percstaff:IsPercussion() then
>>>>     local perclayoutID = percstaff:CalcPercussionLayoutID()
>>>>     local perclayout=finale.FCPercussionLayoutNotes()
>>>>     perclayout:LoadAllForItem(perclayoutID)
>>>>     if perclayout~=nil then
>>>>         for layoutnote in each(perclayout) do
>>>>             layoutnote:SetClosedNotehead(string.byte("x")) --set all
>>>> closed noteheads to "x"
>>>>             layoutnote:Save()
>>>>         end
>>>>     end
>>>> end
>>>>
>>>>
>>>> _______________________________________________
>>>> 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
>>
>>
>>
>> _______________________________________________
>> 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
>





More information about the JWLua mailing list