Indiscripts

Tag : ExtendScript

JsxBlind's New Version for ExtendScript Developers

JsxBlind 1.0 for ExtendScript CS4/CS5/CS6/CCJsxBlind 1.007 is available today—still for free—and now delivered in two formats: a standalone script (JsxBlindRun.jsx) that offers a quick and easy way to scramble a JSXBIN file straight from InDesign (as previously), and a “includable library” (JsxBlindLib.jsxinc) that provides advanced options to developers who need to plug JsxBlind features in an automated workflow (ESTK extension, panel development process, or any custom framework.)

Continue reading...

Drawing Spirals in InDesign

Bézier curve approximations of Archimedean spirals

Continue reading...

JsxBlind | The First JSXBIN Obfuscator for ExtendScript

As Christmas is approaching I wish to share with the scripting community a very unexpected utility, which for legal reasons I can hardly tell anything detailed! Paradoxically, as you shall see, JsxBlind aims to protect script authors from being despoiled…

Continue reading...

“InDesign automatisieren,” a Scripting Bible (in German)

“InDesign automatisieren – Keine Angst vor Skripting, GREP & Co.”, by Gregor Fellenz, dpunkt.verlag.It took me time to read the second edition of Gregor Fellenz' InDesign automatisieren since I do not speak German (!) but this book certainly is the best print reference for discovering InDesign scripting realm. Non-German speaking readers might find it pointless to review this book on my website. However it fills a huge gap and should be considered a model by many of us…

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...

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

The pattern array.sort(compareFunc) is widely used by JavaScript programmers when elements being sorted are not supposed to represent basic strings in the sense of UTF16 ordered character sequences. In particular, sorting numbers forces you to provide that stupid custom compareNumbers routine which, in most cases, just looks like function(x,y){return x-y}. And even when you have to sort actual strings, there are countless situations where the default Unicode code point order is inappropriate. But a question arises: what is the performance cost of using a non-native comparison routine?

Continue reading...

Drawing Sine Waves in InDesign

Bézier curve approximation of sine waves

Computing Bézier curves that really look like sine waves is an exciting challenge for script developers. One needs to deal with both optimizing control points, transforming coordinate spaces and splitting curves. Here is a function that solves it all in ExtendScript for InDesign.

Continue reading...

ExtendScript Core Entities Diagram

Exploring the prototypal relationships between basic ExtendScript's entities reveals an interesting network of hidden objects. The following diagram shows that ExtendScript's own implementation of JavaScript is deeply connected with a root function (referred to as [[Function]] in the figure) which provides the actual prototype—that is, the __proto__ property—of many visible objects, including Function and Object themselves…

Continue reading...

“Do You Plan to Have your Products CC-Compliant?!”

A lot of users and customers are anxiously awaiting updates of BookBarcode, IndexMatic, and other Indiscripts' tools that still refuse to properly work in InDesign CC. “Why does it take so long to have my favorite script running in my new environment?”, they ask…

Continue reading...

Page Range Formatter

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...

Meet Loïc Aigon, Automation Expert!

My colleague Loïc Aigon recently updated his professional website: loicaigon.com. I take this opportunity to let him unveil axis and motions of a misknown job: automation expert

Loïc's Home Page / Design: Doopix.fr

Continue reading...

Making String.split() support U+0000 in ExtendScript CS4

For obscure reasons ExtendScript 3.x is somewhat allergic to the character "\x00" (U+0000). Some String and RegExp routines become silently defective as soon as your source string contains one or more NUL character. Although most of these bugs have been fixed in CS5 (ExtendScript 4.1), this still leads to compatibility and portability issues. Here is a snippet that allows to split any string and get proper results in all versions.

Continue reading...

ExtendScript RegExp Tester

Test your Regular Expressions in ExtendScript

Continue reading...

Notes on ‘fastEntireScript’ Undo Mode

In April 2009, Thomas Silkjær reported a bug on app.doScript that alters the ‘undo’ feature in InDesign. Although this issue has been fixed in CS5, there are still some pitfalls to beware of when you want to speed up your script through fastEntireScript

Continue reading...

Comparing the Performance of ExtendScript Snippets

Although jsPerf is a very effective tool in a pure JavaScript environment, you may want to benchmark competing code snippets in the specific ExtendScript field. Here is a simple way to test and improve your InDesign scripted functions…

Continue reading...

My First Extendables’ Script for InDesign

A few days ago, Stijn Debrouwere has disclosed Extendables, an unprecedented open source framework for Adobe ExtendScript. So exciting! This project will interest many script developers, especially those dealing with InDesign. “If you're doing any serious scripting, Extendables will definitely make your life easier,” Stijn said. “It includes some of the newer Javascript 1.6+ Array methods like forEach, useful shortcuts/monkeypatches and modules for logging, HTTP connections and creating user interfaces.” I tested for you this yet young but already powerful scripting catalyst.

Continue reading...

Operator Overloading with ExtendScript

Operator overloading in JavaScript is a controversial issue. Actually, this dangerous feature has been rejected in ECMAScript 4. However, ExtendScript allows you to override the behavior of many mathematical and logical operators on a class-by-class basis since CS2.

Continue reading...

Binary JavaScript Embedment (CS4/CS5)

The jsxbin format (“Binary JavaScript”) is a boon for developers because it enables them to distribute a script without exposing its precious code. The ExtendScript ToolKit (ESTK) offers an Export to Binary feature which instantly converts a human-readable js(x) file into jsxbin. InDesign can then interpret this file as if it were a pure JavaScript. The only (boring!) problem is that the encoded script is not allowed to load a persistent session through the #targetengine directive. Here is a secret trick to bypass this limitation with a single encrypted file.

Continue reading...

Can InDesign Script Rewrite Itself?

As illustrated by the YALT technique, it's easy —and powerful!— to let a script read its own bytes while it is running. We could even go further and get a script to update itself to achieve some advanced functionalities.

Continue reading...