Thanks to both Glenn and Serge for your input. Locking the track just means that that the script doesn't detect any duplicates. But your suggestion, Glenn, did force me to use the 2021 Cakewalk by Bandlab (I normally run CAL scripts in my aged Cakewalk Pro 9.0) and I found by accident that the script removes duplicates from track 1, and only track 1 in the 2021 edition, which essentially solves my problem. Why the script should behave so differently in the two editions, I don't know