Indiscripts

Automating InDesign since 2009

Tag : JavaScript

Let's Play with JS Array Objects (in ExtendScript)

IdExtenso provides a new ArrayAs2D module that unleashes the hidden strengths of ExtendScript operators. With this toy, you can now write code that adds, multiplies, evaluates 2D points or vectors. For example, if you develop an InDesign script based on Bézier curves or working on polygonal paths, all calculations of points, distances, normalized vectors, etc. become wonderfully compact…

Continue reading...

Make `&` (almost) Behave as a Reference Operator

Suppose you have an ExtendScript class (I mean, “prototype”) whose methods essentially return new object instances. As an obvious example, consider the concat or slice methods of Array.prototype. They always produce a new array rather than reworking the existing one. There are situations where you want to update the calling object —and make this explicit in the code— while still leveraging the methods already available…

Continue reading...

Built-In String Features in IdExtenso

If you are one of the happy users of the IdExtenso scripting framework for InDesign, you may have noticed — or overlooked! — that this enhanced version of ExtendScript provides many additional services, including in the primitive areas of the language. For example, any string immediately has functionalities like trim(), codePointAt(), toUTF8(), which aren't available in the root syntax. Let's take a closer look at this toolbox…

Continue reading...

Meet Kasyan Servetsky, InDesign Wizard!

At the same time graphic designer, illustrator, prepress expert and scripting guru, Kasyan Servetsky has become one of the most active resource sharers in our microcosm. The InDesign community knows him well (but not enough for my taste!) because of the dozens of great utilities he has created over the past two decades: converters, batch processors, link managers, image resizers, font collectors, and many other gems. Let's step into the lab of this productivity freak…

Continue reading...

15 InDesign Scripts and Snippets You May Have Missed

Indiscripts Goodies are available on GitHub too!If you visit this website from time to time, you know that it contains a plethora of free InDesign scripts, but you may not know that other cool nuggets are regularly open-sourced in our GitHub repository called IdGoodies. The latter being hardly documented, here is an overview of some scripts—and interesting code snippets—you will find there…

Continue reading...

Getting Started with IDJS (InDesign UXP Scripting Format)

The funniest thing I've read about the ExtendScript-to-UXP migration is in the (AI-generated?) documentation from Adobe: “ExtendScript uses an antiquated version of JavaScript (ES3), from the era when JavaScript was coded on punched cards.” LOL! Adobe is trying to make us feel like our JSX scripts are ancient artifacts, but let's see if IDJS will actually bring about a technological revolution in InDesign…

Continue reading...

Page Range Formatter [UPDATE]

Given an unordered set of page numbers—e.g. {13, 9, 25, 12, 11, 8}—we often have to compute and output a range specification in the form "8-9; 11-13; 25". While this topic has been already discussed in the InDesign scripting forum, I'd like to explore today a slightly different approach…

Continue reading...

The Cell Tint Enigma

How do Tint objects operate at the Cell level?

Continue reading...

Understanding the `count( )` Method

InDesign's scripting infrastructure is based on DOM objects (Document, Story, Paragraph…) and any such object has an associated collection (Documents, Stories, Paragraphs…). Collections typically arise in complex specifiers like myDocument.stories.everyItem().words. They also provide two essential members, the length property and the count() method. How do they differ?

Continue reading...

InDesign Scripting Forum Roundup #13

Here are nine useful InDesign scripts extracted from one year of debate in the scripting branch of forums.adobe.com. There are snippets for every taste—text, layout, graphics, geometry, UI—so take a look!

Continue reading...

InDesign Swatches: Diagram

DOM Swatches: properties and relationships.

InDesign Scripting Forum Roundup #12

Hey scripters, are you familiar with InDesign events, event listeners, menu actions, idle tasks? That's the hot focus of the 12th ISFR. Plus a fine selection of threads and snippets involving GREP, text, CMYK swatches, IDML, transformations… Enjoy the ride!

Continue reading...

InDesign Scripting Forum Roundup #11

What's on the menu for this 11th episode? My personal selection of the most interesting, verbose, and technical discoveries that took place in the InDesign Scripting Forum within the last eight months. Each topic (and code snippet!) will teach you something you probably didn't even suspect…

Continue reading...

IdExtenso: ExtendScript Framework for InDesign Ninjas

Driven by a mix of vanity and liberalness I decided to make public the building blocks of my InDesign scripting framework, which I called IdExtenso. The alpha release is now available on my GitHub account and will be regularly extended in the coming weeks and months…

Continue reading...

InDesign Scripting Forum Roundup #10

InDesign scripts may involve unexpectedly complicate solutions for addressing tasks that seemed initially quite easy, as well as unexpectedly simple codes for solving crooked problems! The mood of the 10th episode of our ISFR series reflects this ambivalence quite well. As usual I try to focus on scripts, snippets, and methods, that open up powerful tracks to informed developers…

Continue reading...

Coordinate Spaces & Transformations in InDesign — Chap.4 (Draft)

Chapter 4 of our “Spaces & Transform” eBook is probably both the trickiest and the most important. It tries to reveal the intricacies behind the Scripting DOM resolve() method, the unique tool for setting and processing InDesign locations with respect to the underlying coordinate systems. I spent months figuring out its obscure syntax and improving my knowledge on that particular topic. Understanding the location resolver is a crucial step for developing scripts that can deal in depth with geometry and transformations in InDesign.


Go to the newest release of this document

InDesign Scripting Forum Roundup #9

Here is the new season of the InDesign Scripting Forum Roundup series! In this new episode we shall probe various counter-intuitive concepts and behaviors of the Scripting DOM …and attempt to deliver appropriate solutions!

Continue reading...

Coordinate Spaces & Transformations in InDesign — Chap.1-3

Dealing with coordinate spaces and transformation matrices is one of the most obscure and underappreciated exercises in InDesign scripting and programming. The fault mainly lies with Adobe documentation, especially the Scripting DOM reference, which does not clearly explain the topic and some of its essential keys. The following document (PDF, Chapters 1-3) attempts to shed some light on the beast…


Go to the newest release of this document

InDesign Scripting Forum Roundup #8

Summer is the ideal time to deepen your knowledge of InDesign scripting, isn't it? In this new episode of our roundup series we will investigate Page objects, style groups, and a nice selection of practical snippets. Feel free to grab and share the good stuff…

Continue reading...

Reconsidering Array.sort( ) in ExtendScript/JavaScript — Part 2

In my previous post I introduced some key concepts and tools for benchmarking Array.sort() and took you through the “standard model” of optimizing the callback function. We also emphasized that, of course, it is impossible to go faster than the native method. If these clues made you sit up and take notice, it's time to go one step further…

Continue reading...

- Page 1 of 3