Indiscripts

Automating InDesign since 2009

Tag : Algorithms

SmartSort 1.21 for InDesign CC/CS6/CS5/CS4

SmartSort, free script for InDesign CC/CS6/CS5/CS4SmartSort is a free InDesign script that sorts paragraphs or cells. It produces a lexicographic order consistent with the language considered. Version 1.21 fixes an issue related to case discrimination in various ‘tailored’ languages. It also deals with the letter ⟨ё⟩ in Russian.

Continue reading...

What’s New in IndexMatic³ [UPDATE]

Imagine you can extract, quantify, analyze and index every bit of text from your InDesign documents, in any language, based on your own criteria: a predefined word list, a set of fine-tuned regular expressions, such or such character styles or containers. This tool has just been born and is called IndexMatic³.

Continue reading...

The Magic Parent Bounding Box

Now what is the geometry of that cell?Geometry in InDesign can get deadly complex. Take a document, create a frame, insert a table, change a particular cell into a “graphic cell,” convert its inner object into an ellipse, play with strokes, rotate and scale the object, transform the parent frame in the fanciest way. Then ask yourself the question: what are the exact coordinates, shape or area of the final table cell?…

Continue reading...

The Case of Converting InDesign Inches to Ciceros

While working on his Measurements scripts, my colleague Mikhail Ivanyushin reported me weird biases related to units conversion. In particular, he observed a discrepancy between InDesign's display and direct results from ExtendScript when addressing inches-to-ciceros translation…

Continue reading...

SmartSort 1.17 for InDesign CC/CS6/CS5/CS4

Fast, free, and feliz, SmartSort is an InDesign script that alphabetizes word lists (paragraphs or cells) with respect to the language used in your text. It's as easy as Right Click ▸ SmartSort… ▸ Sort! This new version essentially provides stability fixes. Download/update right now, and enjoy ;-)

Continue reading...

The Definitive Tutorial on Bézier Curves

The Beauty of Bézier Curves, by Freya Holmér

Freya Holmér premiered in August a grandiose tutorial video, The Beauty of Bézier Curves, that every developer and/or graphic designer should watch! Especially if you are interested in the internal coding of outlines and path points 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...

Introducing SmartSort for InDesign [UPDATE]

SmartSort, a new script menu action for InDesign CS4/CS5/CS6/CC

Continue reading...

The Tricky Side of `string.replace( )` in ExtendScript

When you invoke myString.replace(...) in pure JavaScript, the “string being examined” is and remains myString during the whole operation. ExtendScript offers a slightly different mechanism that may unexpectedly alter the output string…

Continue reading...

SmartSort 1.05 | New Design, New Options

Many thanks to Peter Kahrel for his valuable suggestions and samples regarding word-by-word and letter-by-letter systems. SmartSort 1.05 is out in a fresh skin with more detailed—and relevant—options. (To upgrade from the beta release, quit InDesign, replace the old SmartSort.jsx file and restart the application.)

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

FillBleed | Fix Image Frames so they Meet the Bleed Edge [Update]

Continue reading...

How to Shuffle Characters the Right Way

While fine-tuning a layout you usually need to put some dummy text in your template. The common way to fill a frame with lorem-ipsum-like data is to call Type > Fill with Placeholder Text. But sometimes you already have an actual text in place, and then your missing feature is the ability to scramble existing characters. Thanks to IdExtenso we can write a nice and fast scrambler, based on Markov chains…

Continue reading...

On Dichotomic Divide-and-Conquer Algorithms

From what I observed, InDesign scripters do not naturally resort to the dichotomic (or binary) search algorithm when it comes to find a numeric solution to problems as wide as adjusting frame bounds to some constraint, determining an optimal text size, or simply accessing a needle in the haystack. Yet the binary search approach is nearly always the best. So let's make it more popular…

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