Updated 23-Feb-2010 Added video
You’ve spend a few days working on some great layouts for a customer. Lots of bulleted lists and tables, and when you receive the first proof back, many of the lists and tables have a note on them: “can you please sort this in alphabetical order”?
I won’t ask you what your first thought is when you read this scenario. But my response to my customer would be: “Not a problem, I’ll have an amended proof for you this afternoon, that will have things sorted as requested”. So two separate tasks to perform… and I’ll break them into two separate posts. This being the first.
Sorting Paragraphs
Let’s start with the sorting of paragraphs in alphabetical order.
I’m revealing secret number one… we won’t be going through cut-paste steps here… I just don’t have the time to show you how to reorder a long list alphabetically like that. Instead I’d like to introduce you to one of the sample scripts that is supplied with Adobe InDesign. It is designed to sort paragraphs in alphabetical order. What’s a script you might ask? Well it’s like a little bit of code that has been written to perform a particular task automatic, that you might otherwise need to perform manually.
Sample scripts come installed with InDesign CS3 and higher. For earlier versions of InDesign the set of sample scripts can be downloaded from the Adobe web-ste:
So where do we find these magical scripts? They come pre-installed with an InDesign installation. You access them from the Automation > Scripts panel.
The default install in InDesign will provide a series of Sample Scripts. On the Mac in AppleScript and JavaScript format, on Windows OS the AppleScript is replaced by VB Script. AppleScript as the name says, is specific to the Mac OS. VB Script support in InDesign specific to Windows OS.
To stick with common ground between the OSes, let’s expand the JavaScript folder in the Scripts panel and see what that brings us in available Scripts.
Plenty of Scripts there as you can see. I posted a summary of what each of these does quite some time ago.
Time to start sorting those paragraphs. Start by highlighting the paragraphs that need to be sorted (Type tool).
How to use a script in InDesign
There are a number of methods you can use to execute the script: Double clicking the script name in the list, or selecting the script then choosing Run Script from the Script panel menu. You can even assign a keyboard shortcut to a script if you want.
I’m using the Run Script command from the Script panel menu.
As soon as the script is executed you’ll be prompted with an additional dialog, asking for some input on your end.
The Sort Options dialog appears.
First input requested from us as a user of the script is whether or not the Sort Method choose needs to Retain the formatting of the highlighted text. If you hadn’t yet formatted your text, I would always stick to the default Ignore Formatting option, it’s nice and fast. However if you have formatted your text, then use Retain Formatting. Yep, I know it says “slower”. but believe me … slower is still fast! Depending on how much text you have highlighted… it might still all be sorted in a blink of an eye!
Yes, you can get away with retaining formatting when using the default ignore formatting settings, however, I won’t guarantee that will always work! For instance when you have a paragraph style applied to your text and also have some style overrides applied to the start of a paragraph, you’ll see some interesting (if that’s what you call them) results.
Ignore Spaces, when selected basically ignores any leading spaces found at the start of a paragraph, and sorts on the first non-space character found in that paragraph. So if you want your spaces to sort at the top of the sort order, deselect this option.
Reverse Sort, will sort in descending (Z-A) order instead of ascending (A-Z) order.
With your settings all sorted, click OK (and don’t blink an eye!! or you’ll miss it!).
All done! Now aren’t you glad you told your customer you’d have it done quickly. They’ll love you for it for sure!
This write-up is continued in a second blog-post.
Video Tutorial
@Arlene ha-ha manual sorting is now a thing of the past 🙂 you might find some of the other scripts useful as well.
I must thank you for this little tidbit. I’ve always wondered if there was a way and there was! My life is better because of it.
Cheers!