Replace a label with a different one
This script will remove an old label from a page and replace it with a new one.
string oldLabel = "old_label";
string newLabel = "new_label";
//get all pages with the old label
number [] pages = selectPages("label = \"" + oldLabel + "\"");
//loop through each page
for(number page in pages) {
//get the pages labels
string [] lbls = %page%.labels;
//remove the old label from the labels list
lbls = arrayDeleteElement(lbls, oldLabel);
//add new label to the list
lbls += newLabel;
//set the labels for the page
setLabels(page, lbls);
}