for (y = SelTop; y <= SelBottom; y++) { for (x = SelLeft; x <= SelRight; x++) { str = [x,y]; str = replace(str, "A1", "name"); str = replace(str, "A2", "class"); str = replace(str, "A3", ""); str = replace(str, "A4", "mode"); str = replace(str, "", ""); str = replace(str, "", ""); if (str != [x,y]) { [x,y] = str; } else { [x,y] = ""; } } }