import se.datadosen.util.*;
import se.datadosen.tags.*;

msg =
"Feed the image directory a directory containing html files with comments. \n" +
"This script will extract the comments and put them in a comments.properties file";

JOptionPane.showMessageDialog(window, msg, "Example tool", JOptionPane.INFORMATION_MESSAGE);


File[] files = rootImageDirectory.listFiles();

StringBuffer commentDoc = new StringBuffer();
for (File f : files) {
	if (!f.getName().endsWith(".html")) continue;
	String content= IO.readTextFile(f);
	Element e = Elements.getElementByName("SPAN", content, false);
	if (e != null) commentDoc.append(engine.jpegName(f.getName()) + " = " + e.getContent() + "\n");
}
IO.writeTextFile(commentDoc.toString(), new File(rootImageDirectory, "comments.properties"));