Archive
Script: tomaxxiLAYERS® / Add Layer Sets to Document [UPDATED]
As you probably know, layers really important when creating complex layouts. Layers in last version of InDesign (CS5) are radically improved! Till now, you could just manage top-level layers, but starting with CS5, top-level layers can be expanded and you can see complete object structure! (for more info about layers in CS5, read great article written by Steve Werner on InDesignSecrets [Hidden Gems: The Layers Panel in CS5]) That’s really great! But, main limitation is that we are not able to set “default” layers for every new document. But! That’s why we have scripts!
Easy way to UnEmbed all Embedded links
Have you ever received document with all links embedded into it? It’s not everyday scene, but it happens, and InDesign has option to unembed link(s) to folder.
But, if you have bunch of links, you need to sort them first, select just embedded ones and then click Unembed Link from Links panel menu, or from context menu. But, it can be done much more easily with help of short script! Let’s see how!
Saving Script Data using JSON [Part 2]
When building complex scripts with lot of options that user can choose, it’s always great to allow user to also save selected settings and reuse them on next launch. We already discussed about this topic in earlier post [Saving script data within document] but I recently found better way for serializing and storing data.
In first post, I used simple “*” to separate multiple values, and at load time used split(*) to separate values back to Array. That’s not bad, and it’s working fine, but there is another much more elegant solution!
What is JSON? JSON (JavaScript Object Notation) is a lightweight data-interchange format in other words it’s Associative array. It is, among other things, a faster, simpler, easier-to-use alternative to XML. More info about JSON can be found here: Introducing JSON. That’s great, but how to use it in InDesign?! How to save/load values?
I created short sample to demonstrate usage and shortly explain how it works. Of course, you can extend it as you wish! So, let’s get started!
QuickTip: Find Object Properties Quickly
Finding properties in OMV (Object Model Viewer) can be really painful, and slow. Personally, my best friend when writing scripts is Theunis de Jongs (aka Jongware) InDesign JavaScript Reference Guide but also trying to remember connections between objects and when to use which property, class, method… But, there is also another way to find out what properties you can use, and it’s already built in. Key is in Object reflection! So, let’s take a look how to put it in use!
QuickTip: Counting Text using everyItem()
Counting words and also paragraphs, stories, characters is something pretty easy to achieve, but very often done in wrong way. Most of the time, people are looping through stories, text frames, paragraphs and adding word count. That is OK, for short documents, with short stories, but as document length increases, script needs more and more time to loop through all stories, and get all words. People are forgetting about awesome method called everyItem! Method remained undocumented until InDesign CS3, but scripting experts such as Dave Saunders had already pointed out its forcefulness and already knew how to exploit it. It allows us to get all elements within collection. For more info about everyItem method be sure to check two awesome articles by Marc Autret: On ‘everyItem()’ – Part 1 and On ‘everyItem()’ – Part 2. So, let’s take a look how everyItem method can help us count stuff.
QuickTip: Loading Files to PlaceGun
After long time here comes new post about InDesign scripting!
This one is really cool and handy. Simply select files and script will load them directly into PlaceGun tool! Really simple and handy! Also there are some options that you can set while loading files into PlaceGun, but we will just focus on simple loading. One more thing. InDesign CS5 DOM introduced new class that is directly connected to PlaceGun. It has some more options like: abortPlaceGun and rotate among others. So, let’s get started!
Script: FontReporter® 2 / Collect used Fonts Info from multiple files
[UPDATED]
Do you need information about fonts used in your document(s)? Do you want to check is some fonts missing in a more than one file? You can do that with FontReporter®!
QuickTip: Turn Off All Caps in Panel Names through Script
Inspired by yesterday post about making Panel Names to Title Case, I made small script to help you enable/disable this feature (Easter Egg) through scripting. What script actually does? It checks if folder “noallcaps” exists in InDesign start up folder, and depending on our selection it creates/removes folder. I also added check for folder contents, so if there are files inside, folder will not be deleted.
You can download script here:
That’s it!
Have fun!
QuickTip: Turn Off All Caps in Panel Names
Are you annoyed with all panel names in All Caps?! There is really easy way to turn them into Title Case! Tested with InDesign and InCopy CS4 and CS5!
Be sure you check out Don’t Like All Caps in the Interface? Try This For Some Relief on InDesign Secrets website!
Have fun!

Copy All Anchored/Inline Objects to a New Layer
Few days ago on Adobe’s InDesign Scripting forum I found question about duplicating all anchored and inline objects to another layer. It’s quite simple task, and all we have to do, is to get all page items, and check item parent. If parent is Character, then it’s anchored/inline object. So, let’s take a look!
QuickTip: Add Custom (CMYK/RGB/HEX) Colors to Document
Want to add custom colors to document? Wanna do it fast and painless? Here is short function that will do all job for you!
Storing custom data into InDesign file via XMP
Storing data within InDesign document is possible with insertLabel() but there is another place to save information about document. As we know, all InDesign documents have metadata stored in file itself. For more info take a look at other Metadata related posts listed at the end.
We are able to insert our own data into Industry standard namespaces, but also we can create our own namespace, and insert data into it. We will go through few examples. So, let’s start!
QuickTip: Insert Text Variable to Text Frame
Wanna insert text variable to text frame through scripting? No problem. It’s fast and easy!
Question about this showed up about one week ago on Adobe’s InDesign Scripting forum, and I was also curious how to do it. I don’t want to write much, so, let’s go down to business
Fill InDesign XMP info from document content
A few days on Adobe’s InDesign Scripting forum I found question about inserting info into XMP InDesign file info. Also, mission was to find text formatted into specific paragraph style, and insert found content into XMP’s ‘Document Title’. Easiest way to achieve this is to use ‘Find’ and search for paragraph style. But, I also wanted to insert some more info into XMP like keywords or author, through scripting. So, I created document with some text from Adobe InDesign Features page, created two paragraph styles for Title and Author, and character style for keywords. So I formatted title and author with paragraph styles, and also I ran through text and formatted some words with ‘Keyword’ character style. So, let’s see how it works!
Extract file preview stored in Adobe XMP data
Some of Adobe file format’s (INDD, PDF, AI) are using Metadata to store low-res preview of file inside file itself. For example InDesign allows you to select how many pages do you want to include in these previews and also preview size/quality. We have to keep in mind that data is not stored in binary format. It’s stored in, so called, Base64 encoding scheme, that represent binary data in an ASCII string format. So, in addition to extracting data we have to decode it to binary, and then save it to file. So, let’s get started!
Import Styles from file
Do you want to import styles from other document through scripting? It’s really easy to achieve, and you also have control about overwriting styles with same name. Also, you can import all kind of styles, you are not limited to just Paragraph or Character styles. We will take a look to the style ‘importStyles()’, but I also prepared short example how to implement it in dialog. Also, keep in mint that we can import to the document or to the application. So, let’s get started!
Find/change missing font with scripting
Does this image looks familiar?! Do you want to change missing font through scripting? Then I have good news for you, it can be done really fast and easy! We are going to look easiest way for retrieving missing fonts from document, and also I will share this script integrated into dialog and font selector. This idea came up to me yesterday while I was studying ‘BeforePrint.jsx’ from Scripting guide that you can download from Adobe InDesgin scripting page. Also, Marc Autret posted script on Adobe’s InDesign Scripting forum for changing missing fonts inside styles, so be sure you check it! So, let’s get started!
Custom ScriptUI Text Insert Menu
Few days ago on Adobe’s InDesign scripting forum I found question how to create custom menu to insert predefined text items into ScriptUI text box. I started to research and found really easy and good way you achieve this handy “menu”. All we need is dropdown and short script for controlling insert behavior.
Add icon to dropdown/listbox items
Have you ever wanted to add a dropdown/listbox item but with icon beside? This is not really possible with native InDesign dialog manager, but it can be done with ScriptUI! It’s really easy to achieve this great little feature. So, let’s take a short look how to do this.
Extract Metadata with Adobe XMP [Part 2]
In previous post about Extracting Metadata with Adobe XMP we were extracting complete Metadata from file and saving it to XML file. In this post we will take a look how to extract just those elements that we want. Also, don’t forget to grab Adobe XMP Specification and visit Adobe XMP Develop Center for additional info about XMP Specifications. Before continuing I suggest you to extract Metadata from file to XML or you can find same structure in ‘Links panel -> (Right click on image link) -> XMP File Info -> Raw Data (tab)’. It will be easier to understand and find data that we want to extract. So, let’s get started.
Extract File Name and Extension
This is short and simple. Fast way to extract file name (without extension) and extension from file. Unfortunately Javascript doesn’t allow us to retrieve just file name or extension, but we can achieve it in really simple way through string operations. We are going to create simple prototype for ‘file();’ class. So, let’s get started!
Extract Metadata with Adobe XMP [Part 1]
Almost every media file contains info about it’s contents. Adobe’s XMP (Extensible Metadata Platform) is, as they say, “a labeling technology that allows you to embed data about a file, known as metadata, into the file itself”. Devices like digital camera’s, camcorders, mobile phones also save metadata, and we are able to retrieve that info later. “Various standards initiatives are using XMP as their framework of choice for implementation”. More info can be found here: Industry standards groups powered by XMP. So, let’s see how to grab all saved data from file with really simple code.
Fill Text Frame with Placeholder text
Great InDesign feature is that we can fill empty text box with ‘Placeholder text’. That’s very handy when we have to create template, but we don’t have text. There are few scripts for InDesign that allow us to insert different types of text, but this is my favorite: Change placeholder text by luxlucid. Also, there is very good website for creating placeholder text: Dummy Text Generator! So, let’s get started!
Read more…
Round Selected text with Polygon
Well, this one is really awesome! I was playing with finding positions of selected text, baseline and stuff, and I came to great idea! What if I want to draw polygon around selected text? Can it be done through scripting?!
Well, I tried, and I think I was successful!
It’s little bit complicated, but I learned a lot! So, let’s get started!
Extract Clipping Path
If we want to extract clipping path from InDesign GUI we simply go to Object -> Clipping Path -> Covert Clipping Path to Frame, but how to do it through scripting? Another thing is that we can’t convert multiple selected images with clipping path to frames through GUI, but you can do it through script. I will cover just converting one selected frame, but we can loop through selection and do same to every image.
Export selection to JPEG
I think that title already says everything about this post
and I’ll try to be short. When you are exporting from InDesign GUI you have option to export just selected objects, but how to achieve this from script?
This script is also published on Adobe’s InDesign scripting forum.
Change some Clipboard preferences
There are few useful properties you maybe want to use when copy/paste objects and text in InDesign. You can change them through preferences, but also through scripting.
Move/duplicate pages between documents
Like you probably know, InDesign can move/duplicate pages within document through scripting, but you can also move/duplicate pages between documents! I found this snippet on Adobe’s InDesign scripting forum, and I tested it and it works just fine!
Convert Decimal to Roman and back
Few days ago, on Adobe’s InDesign scripting forum I found something very interesting. It was great little function for number conversion from Decimal to Roman numbers. But it wasn’t I enough so I tried to reverse functionality. Functions are converted to ‘prototypes’ for easier usage.
Create customized menu
Two days ago on Adobe’s InDesign scripting forum I found interesting question about creating custom menu, so I decided to dig little deeper and see how to achieve desired effect. I went to Marc Autrets site, and post How to Create your Own InDesign Menus. I tried to create custom menu that will be inserted into InDesign’s main menu, with three menu items, and one separator.

IndiSnip on Twitter!
IndiSnip on Facebook!
Contact IndiSnip by e-mail!
