Archive

Posts Tagged ‘InDesign CS3’

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! 🙂

Read more…

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! 😀

Read more…

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! 🙂

Read more…

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

Read more…

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! 😀

Read more…

Copy All Anchored/Inline Objects to a New Layer

September 16, 2010 5 comments

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! 🙂

Read more…

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! 🙂

Read more…

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! 😀

Read more…

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.

Read more…

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! 😀

Read more…

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

Read more…

How to retrieve Text Variables

We are going to look at simple way to get all text variables. Important thing is that InDesign had two different lists of text variables. One list is stored in ‘app’ object, and another is in ‘document’ object. This is very important to remember! Part of this script was published on Adobe’s InDesign scripting forum by Peter Kahrel. So, let’s get started.

Read more…

Get Font Styles from Font Family

Few months ago on Adobe’s InDesign scripting forum question was asked about getting all font styles from selected font. I want to share my way for doing this. It involves two prototype Array functions, and nothing else. For this example I created small window for selecting font family. So, let’s get started.

Read more…

Display day/month name instead of number

Sometimes we want to have full day/month name instead of just numbers. Here is really short little snippet to achieve this result. This post also can be found on Adobe’s InDesign scripting forum.

Read more…

Saving script data within document

There is good way to store data within document elements. We can store very long text data into almost every element within InDesign. Data is only visible through scripting, and also can be set just through scripting. This is great way to carry document specific data everywhere we go, because data we set is saved into document. So, let’s see how we can use this great feature.

Read more…

Extended undo/redo

Are you frustrated with lack of History palette in InDesign? Did you know that you can retrieve undo/redo commands from script? 😕 Yeah! That’s right! It’s really easy to achieve History palette functionality with some easy script. I created really simple dialog with two drop-down boxes and undo/redo buttons. 😉 Let’s first how to get list of undo/redo commands that we have available.

Read more…

Change cursor key keyboard increment

For many years I worked just with CorelDRAW and one thing I really liked and I used to was changing cursor key keyboard increment. Unfortunately InDesign doesn’t allow me to change that setting, without going into Preferences. So, I decided to try to create script, with simple dialog box where I can input number, and change setting. This was my very first InDesign script 😀

Read more…

Selecting multiple table rows/columns

Here is short script for selecting multiple rows in table. This will create ‘visible’ selection. This script is also published on Adobe’s InDesign scripting forum but I found some parts on other sites too.

Read more…

Scrollable alert

This is very great and handy script! If you have lot of text or numbers, regular alert dialog just roll text out of the screen, and you can’t see them. Here is an example from “ScriptUI for Dummies”, which is a more useful version of alert: it shows text in a scrollable window. An additional advantage is that you can copy text out of the alert. This was posted on Adobe’s InDesign scripting forum.

Read more…

Check/Destroy all opened dialogs

This is short one, but I use it in some of my scripts. Sometimes, script just hangs, or crashes, and if we used windows in script, they are not destroyed! They are still in memory and they will be there until we close InDesign. But, there is way to destroy all dialogs that are left in memory.

Read more…

Change “greek below” setting

Few weeks ago someone asked on Adobe’s InDesign scripting forum how to change ‘greek below’ settings through script, and I want to share it here also. This time, it’s my snippet 😉 As you probably know there are three ‘Display performance’ settings and ‘greek below’ can be set separately for each ‘Display performance’ settings.

Read more…