macro "EvoPrint Cutter [1]" { inRun=0; inCSB=1; inCSB6=2; n = 1; //text = File.openAsString(""); //name = File.nameWithoutExtension; //dir = File.directory; text = String.paste; lines = split(text, "\n"); longest = 0; for (i=0; ilongest) longest = lengthOf(lines[i]); } firstLine = lines[0]; if (lengthOf(firstLine)>40) firstLine = substring(firstLine, 0, 40); Dialog.create("EvoPrint Cutter"); Dialog.addMessage( "The clipboard contains "+lines.length+" lines of text.\n" + "The longest line contains "+longest+" characters.\n" + "The first line starts with\n " + firstLine + "\n" + "Output will be saved on the clipboard.\n" ); Dialog.addMessage(""); Dialog.addString("Sequence Name:", ""); Dialog.show(); name = Dialog.getString(); lines = split(text, "\n"); for (i=0; i>>")) { String.append(line); String.append("\n \n>"+name+"-"+(n++)+"\n"); } else if (len==0) { String.append("\n"); } else { cuts = newArray(len); runStart = 0; runLength = 0; csbStart = 0; csbLength = 0; state = inRun; for (j=0; j=65 && code<=90) { //upper case if (state==inRun) { state = inCSB; csbStart = j; csbLength = 1; } else if (state==inCSB) { csbLength++; runLength++; if (csbLength==6) { state = inCSB6; runLength -= 6; } } else csbLength++; } else { //lower case if (state==inCSB6) { if (runLength>200) { cutAt = runStart + floor((csbStart-runStart)/2); cuts[cutAt] = true; //print("cut: "+i+" "+ cutAt+" "+ runLength+" "+ csbStart+" "+ runStart); } state = inRun; runStart = j; runLength = 1; } else if (state==inCSB) { state = inRun; runLength++; } else runLength++; } } // for j for (j=0; j"+name+"-"+(n++)+"\n \n"); String.append(substring(line, j, j+1)); } String.append("\n"); } } // for i //File.saveString(String.buffer, dir+name+" (cut).txt"); String.copy(String.buffer); }