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

Is there a formal/informal language reference for InDesign JS scripting?

Engaged ,
Sep 07, 2023 Sep 07, 2023

Copy link to clipboard

Copied

Sometimes, Google Search really lets you down. This is one of those times. If I didn't know better, I would believe that Adobe intentionally obfuscates any scripting language references for their apps. But surely someone somewhere has a valid, functioning reference for the language model used by InDesign for js programming.

 

And before you refer me to the Adobe Developer's page where I can download the Scripting file for InDesign, please know that it doesn't contain a language reference. It is a bunch of help files for various tasks you might want to accomplish. That's fun and all, but literally the files are so unbelievably poorly presented that it locks up Chrome repeatedly. Even with 32Gb RAM, nothing else open, and running without extensions, it still locks up. There is something  terribly wrong with the files provided.

 

But even if there was some way to effectively browse the local files, there is no language reference.

Before you suggest thousands of great example script sites and tutorials, please understand that I have hundreds of tutorials and reference lists from great InDesign programmers, but NONE of them include a simple language reference.

 

For example, the following site has the JS Language reference.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference

Sure it has examples, but it gives the terms, the properties and methods for the term then an example. I just cannot find this anywhere for InDesign..

 

The biggest problem that I am having with InDesign JS is that there are a million ways to reference every item in InDesign. Some ways provide usefull methods that aren't available other ways. Without a comprehensive language reference, I am constantly trying to assert methods on objects that don't have that method. All of this could be easily solved with a simple dictionary. 

 

Thanks for any help you can offer. If you need some free example scripts or tutorials, I have a ton of them. This post is not about getting something accomplished that I can copy and paste from a sample script, it's about finding the language reference so I can write my own scripts. 

TOPICS
Scripting , SDK

Views

251

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
Explorer ,
Sep 07, 2023 Sep 07, 2023

Copy link to clipboard

Copied

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
Community Expert ,
Sep 08, 2023 Sep 08, 2023

Copy link to clipboard

Copied

Hi @Jason Burnett,

There are 3 aspects to this.

  • The JS part or capability of InDesign scripts. So ESTK uses an old version of ECMA script, ECMAScript 3 standard. So if you find modern JS features not available to you, then this is the reason. For modern JS you can explore UXP scripting but that is still evolving
  • The DOM api's and methods, for this you can refer the link shared by @davidt12412601 
  • Knowing about the InDesign terms and their relation with each other, this will help you make a good guess as to what area of the DOM you need to investigate to accomplish what you are trying to achieve.

I hope this helps

-Manan

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
Guide ,
Sep 08, 2023 Sep 08, 2023

Copy link to clipboard

Copied

Hi Jason,

 

1. On the language side, ExtendScript essentially complies with ECMAScript 262, 3th edition, sometimes referred to as E262-3. It also supports the ECMAScript for XML add-on, referred to as E4X and specified by the now-deprecated standard ECMA-357. These are the main references on the programming language itself, although ExtendScript also has a few syntactic sugars, directives and little-known behaviors that only experts have been able to discover and report over the years. To my knowledge, there is no comprehensive ExtendScript reference that you can trust as a bible, and that's indeed unfortunate. For the record, the first edition of Adobe's InDesign Scripting Guide (2001, 610 pages) had only two branches: “AppleScript Reference” (Mac) and “VisualBasic Reference” (Windows).

MarcAutret_0-1694187856713.png

The so-called “JavaScript” section appeared in the InDesign CS2 Scripting Reference (2005, 1928 pages), which states:

 

quoteInDesign supports JavaScript for cross-platform scripting. InDesign’s JavaScript support is based on an Adobe implementation of JavaScript known as ExtendScript. The ExtendScript interpreter conforms to the current ECMA 262 standard for JavaScript. All language features of JavaScript 1.5 are supported, including try/catch/finally, equality operators, and the new instanceof and in operators. Adobe GoLive® and other Adobe products also use the ExtendScript JavaScript interpreter.

 

MarcAutret_1-1694188464417.png

However, Adobe documentation doesn't actually detail ExtendScript syntax per se. It's not a specification. The “Scripting Guide” (a companion PDF) will just reveal some implementation-specific objects: File, Folder, $, $.global, Reflection, Socket, UnitValue, etc, which we qualify all together as “Core JavaScript Classes” (following the ESTK terminology). In addition, a special scripting layer referred to as ScriptUI is available within its own cluster and will remain almost undocumented. Various documents were disseminated by Adobe for a good decade and contained essential information to be put together like pieces of a puzzle. Regarding ScriptUI, Peter Kahrel did a lot of the work in his ScriptUI for Dummies.

 

2. On what we may call the semantic—or pragmatic?—side, ExtendScript for InDesign involves a huge Document Object Model (DOM) architecture, also referred to as the “InDesign Object Model” (ESTK terminology). The crucial difference with “core” and ScriptUI extensions is, the DOM is constantly updated to reflect new features (at least, those that the team agrees to expose to ExtendScript). Now let's be honest, this part of the puzzle has always been well documented (either in the SDK, or through XML references). Thanks to Gregor Fellenz, we also have a clean interface for browsing the DOM API: InDesign ExtendScript API Object Model. (Gregor's browser also includes core and ScriptUI branches, btw.)

 

Best,

Marc

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
Adobe Employee ,
Sep 08, 2023 Sep 08, 2023

Copy link to clipboard

Copied

LATEST

In addition to the comments above, I'm on a developer experience team for Creative Cloud, and my team has been rolling out documentation for InDesign UXP APIs, which implement modern JavaScript. We're working on improving Google search SEO, too.

 

Here are two examples of language reference guides we've created:

 

When you say this:

 

And before you refer me to the Adobe Developer's page where I can download the Scripting file for InDesign, please know that it doesn't contain a language reference. It is a bunch of help files for various tasks you might want to accomplish. That's fun and all, but literally the files are so unbelievably poorly presented that it locks up Chrome repeatedly. Even with 32Gb RAM, nothing else open, and running without extensions, it still locks up. There is something terribly wrong with the files provided.

 

Do you mean this HTML archive (below)? Just curious. I've never had it lock up my machine, and I have 16 GB of RAM.

 

Screen Shot 2023-09-08 at 3.52.52 PM.png

 

 

 

 

 

 

 

 

Agreed, it doesn't contain langauge reference.

 

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