//Expects an old key table on the clipboard //such as shown below, puts result to Log //Example: Copy text fragment after '--begin--' and before '--end--' to the clipboard // then run the macro //02.01.19, 18:06 /*--begin-- keyTable += "#33, hke-3, Shell"; keyTable += "#34, hke-4, Shell"; keyTable += "#36, hke, SpotA"; keyTable += "#40, lin-0, Shell"; keyTable += "#41, lin-1, Shell"; --end--*/ macro "Format Old Species List From Clipboard [2]"{ print("\\Clear"); txtIn = String.paste; lines = split(txtIn, "\n\n"); txtOut = ""; for(jj = 0; jj < lines.length; jj++){ line = lines[jj]; s = line; if(indexOf(s, "Shell") >=0) shellChar = "*"; else shellChar = " "; s = replace(s, '"', "");//no quotes s = replace(s, ' ', "");//no spaces s = replace(s, 'keyTable', "");//no keyTable s = replace(s, '\\+=', "");//no += s = replace(s, '#', "");//no # parts = split(s, ", "); if(parts.length < 2) txtOut += "\n"; else{ s = '+ "'; s += shellChar; s += parts[0] + ", "; s += parts[1] + ';'; s += '"'; s += "\n"; txtOut += s; } } print(txtOut); selectWindow("Log"); }