//rsb // files: 2108 // problem files: 185 // img tags: 2044 // tags without alt: 667 // // nih-image // problem files: 35 // tags without alt: 113 // // rsb // tags without alt: 10 // // docs // tags without alt: 44 // // NeuroChem // tags without alt: 143 // // plugins // tags without alt: 253 testMode = true; dir = getDirectory("Choose a Directory "); files = 0; tags1 = 0; tags2 = 0; fixFiles(dir); print("files: "+files); print("problem files: "+List.size); print("img tags: "+tags1); print("tags without alt: "+tags2); List.clear(); function fixFiles(dir) { list = getFileList(dir); for (i=0; i0 && !testMode) { f = File.open(dir+list[i]); for (j=0; j", start); if (end!=-1) { alt = indexOf(lines[i], "alt", start); if (alt==-1) alt = indexOf(lines[i], "ALT"); if (!(alt!=-1 && alt>>"+path); List.set(path, "xx"); n1 = indexOf(lines[i], "\"", start); n2 = -1; if (n1!=-1) n2 = indexOf(lines[i], "\"", n1+1); name = ""; if (n2!=-1) name = substring(lines[i], n1+1, n2); slash = lastIndexOf(name, "/"); if (slash!=-1) name = substring(name, slash+1, lengthOf(name)); dot = lastIndexOf(name, "."); if (dot!=-1) name = substring(name, 0, dot); print("1: "+lines[i]); if (lengthOf(name)>0 && !startsWith(name, "Count.cgi")) { part1 = substring(lines[i], 0, end); part2 = "["+name+"]"; part3 = substring(lines[i], end, lengthOf(lines[i])); lines[i] = part1 + " alt=\""+part2+"\""+part3; print("2: "+lines[i]); return true; } } } return false; }