Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

merge html files using extendscript toolkit cs6

Guest
Sep 10, 2016 Sep 10, 2016

hi all

can anyone suggest how to merge html files using extend script toolkit cs6?

Please help

Thank you

TOPICS
Scripting
444
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Sep 12, 2016 Sep 12, 2016

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()

...
Translate
People's Champ ,
Sep 11, 2016 Sep 11, 2016

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Sep 11, 2016 Sep 11, 2016

Can you please suggest an example? using text string?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 12, 2016 Sep 12, 2016

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);

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Sep 12, 2016 Sep 12, 2016
LATEST

Thanks for your reply

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines