[JW Lua] flip accidentals in selected regions

Jan Angermüller jan at angermueller.com
Wed May 6 15:42:44 CEST 2015


You might need note:SetString ?

Am 06.05.2015 um 15:34 schrieb Joseph Weidinger:
> This almost works... It seems to correctly change the note but it 
> doesn't stick or save. I'm not sure why it doesn't stick as I do 
> iterate over it with "eachentrysaved" and even have an 
> entry.CheckAccidentals = true, if that does anything in this case...  
> What am I missing?
>
> Thanks!
>
> tblOne = {'A#', 'B#', 'C#', 'D#', 'E#', 'F#', 'G#', 'Cb', 'Fb', 'Bb', 
> 'Db', 'Eb', 'Gb', 'Ab'}
> tblTwo = {'Bb', 'C', 'Db', 'Eb', 'F', 'Gb', 'Ab', 'B', 'E', 'A#', 
> 'C#', 'D#', 'F#', 'G#'}
>
> local pitchString = finale.FCString()
> local originalPitchString = finale.FCString()
>
> for entry in eachentrysaved(finenv.Region()) do
>     if entry:IsNote() then
>         for note in each(entry) do
>             note:GetString(pitchString, nil, false, true)
>             note:GetString(originalPitchString, nil, false, true)
>             for k, v in ipairs(tblOne) do
>                 if pitchString:ContainsLuaString(v, nil) then
>                     pitchString:Replace(tblOne[k], tblTwo[k])
>                     print("The pitch", originalPitchString.LuaString, 
> "was changed to", pitchString.LuaString)
>                     break
>                 end
>             end
>         end
>     end
>     entry.CheckAccidentals = true
> end
>
>
>
> _______________________________________________
> JWLua mailing list
> JWLua at jwmusic.nu
> http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu


-- 
Jan Angermüller
Jevenstedter Str. 80
22547 Hamburg
Tel. 040 - 28 94 84 82
www.angermueller.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://jwmusic.nu/pipermail/jwlua_jwmusic.nu/attachments/20150506/33d4a835/attachment-0002.html>


More information about the JWLua mailing list