This doesn't really differ from text parsing and you can quite easily do it with JSL. If we assume that we have combined file like this
//##label script.jsl
//rev 5-9-25
names default to here(1);
dt=current datatable();
selected_rows=dt<<get selected rows();
//##Make a PDF of a data table.jsl
names default to here(1);
show(1);
and it should be separated into label script.jsl and Make a PDF of a data table.jsl, I would do something like this
Names Default To Here(1);
path = "$DOWNLOADS/comb_script.jsl";
save_path = "$DOWNLOADS/";
separator = "//##";
txt = Load Text File(path);
lines = Words(txt, "\!N");
aa_scripts = Associative Array();
cur_filename = "";
For Each({line}, lines,
If(Starts With(line, separator), // new file
filename = Substitute(line, separator, "");
cur_filename = filename;
aa_scripts[cur_filename] = {};
,
Insert Into(aa_scripts[cur_filename], line);
);
);
For Each({{filename, script_lines}}, aa_scripts,
script_txt = Concat Items(script_lines, "\!N");
Save Text File(save_path || filename, script_txt);
);
Write();
Do note that this will remove extra row changes from your data due to how Words works. If you wish to keep them, you can loop over the text using Contains and Substr or something similar
Names Default To Here(1);
path = "$DOWNLOADS/comb_script.jsl";
save_path = "$DOWNLOADS/";
separator = "//##";
txt = Load Text File(path);
While(Length(txt) > 0,
separator_start = Contains(txt, separator);
separator_end = Contains(txt, separator, separator_start + 1);
If(separator_end == 0,
separator_end = Length(txt) + 1;
);
cur_script = Remove From(txt, 1, separator_end - separator_start);
cur_filename = Remove From(cur_script, 1, Contains(cur_script, "\!N") - 1);
cur_script = Trim Whitespace(cur_script);
filename = Substitute Into(cur_filename, separator, "");
Save Text File(save_path || cur_filename, cur_script);
);
-Jarmo