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

What does #include do?

Engaged ,
Aug 10, 2017 Aug 10, 2017

Copy link to clipboard

Copied

Hi everyone,

This is a general questions about #include.

I wrote a very long script (around 2000 lines) that imports idml files that have been translated, creates new paragraph styles based on the language, searches the text for keywords and adds hyperlinks to them. Although it worked, it was temperamental. Sometimes it would error, sometimes it just wouldn't create the hyperlinks, and other times it just told me that objects were invalid.

So, since the script was made up of individual functions that each had a small task, I separated them into their own .jsx file and included them in one main file using #include. Then, I just called them one by one.

Now, it works every time, no errors.

I'm wondering, is there something 'under the hood' that I should know about #include?

If anyone can shed some light on this, I'd appreciate it

Jake

TOPICS
Scripting

Views

373

Translate

Translate

Report

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 , Aug 10, 2017 Aug 10, 2017

#include simply links whatever is in the include file, that's all. When you got the script to work after disecting it and placing various things in include files, you probably changed some of the logic and that made things work. There's no magic in #include.

Votes

Translate

Translate
Community Expert ,
Aug 10, 2017 Aug 10, 2017

Copy link to clipboard

Copied

LATEST

#include simply links whatever is in the include file, that's all. When you got the script to work after disecting it and placing various things in include files, you probably changed some of the logic and that made things work. There's no magic in #include.

Votes

Translate

Translate

Report

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