You can find the script here:
https://github.com/marcvanduivenvoor...-by-region.lua
So, what I am trying to do is this.
- I have a guitar DI track which I duplicate into more tracks, based on their name, and the name in the regions I split the items in the tracks.
- So a gtr-di-clean will only have the sections left in the corresponding region gtr-di-clean etcetera.
The splitting part works as expected, all tracks which do not have a name in the split list get ignored, the gtr-di-xxx tracks get split up nicely along the region edges.
In a second loop I try to delete the items, and this is where stuff gets weird.
in the item loop, after the first item gets deleted from the track, the second item (second iteration in the loop) gives the error like the screenshot here.
Does reaper reset the item index or something like that when removing an item?