
Copy link to clipboard
Copied
hi all
can anyone suggest how to merge html files using extend script toolkit cs6?
Please help
Thank you
1 Correct answer
It depends on what you mean with "merge". (I'm also curious as to why you need to do so from within InDesign. This is very basic JavaScripting, and as far as I can see it does not really have anything to do with InDesign itself.)
Here is an example using text strings. It merges two files but it may or may not do exactly what you have in mind.
...file_1 = File("a.html");
file_1.open("r");
html_1 = file_1.read();
file_1.close();file_2 = File("b.html");
file_2.open("r");
html_2 = file_2.read();
file_2.close()
Copy link to clipboard
Copied
I can only see two approaches. One would be to load both files as XML objects and append body children to maybe a new "html" xml object before you write this back to a file. Or you could go and play with text strings.
FWIW
Loic

Copy link to clipboard
Copied
Can you please suggest an example? using text string?
Copy link to clipboard
Copied
It depends on what you mean with "merge". (I'm also curious as to why you need to do so from within InDesign. This is very basic JavaScripting, and as far as I can see it does not really have anything to do with InDesign itself.)
Here is an example using text strings. It merges two files but it may or may not do exactly what you have in mind.
file_1 = File("a.html");
file_1.open("r");
html_1 = file_1.read();
file_1.close();file_2 = File("b.html");
file_2.open("r");
html_2 = file_2.read();
file_2.close();merged_html = html_1+html_2;
alert (merged_html);

Copy link to clipboard
Copied
Thanks for your reply

