Deleting / Removing measures using a plugin
How can you delete /remove measures from a score using a plugin? In particular I wish to delete the last measure in a score.
There is a 'del-empty-measures' command, but I cannot see a command to delete a particular measure. There are commands to 'insert-measure' and 'append-measure'
The 'score' object has an 'appendMeasures' method. but I cannot see an insert measures option or a delete measure method.
Barry
Comments
Range select the measure using the selection API, then use
cmd('time-delete')
In reply to Range select the measure… by jeetee
Thanks
The 'time-delete' command does the job.
In reply to Range select the measure… by jeetee
How is this done? It's not clear to me how to select the range using the API to perform this command in order to delete the measures.
In reply to How is this done? It's not… by avronp
https://musescore.github.io/MuseScore_PluginAPI_Docs/plugins/html/class… should cover the selection.
In reply to https://musescore.github.io… by jeetee
Here is sample code that will select a given measure (the code is written in the context of wanting to delete the selected measure - but trying to do the actual deletion will cause musescore to crash unless the last measure in the score is part of the selection):