Skip to main content
Fred.L
Inspiring
May 7, 2025
Question

Strategies for Books Layout automation

  • May 7, 2025
  • 7 replies
  • 2958 views

Hello folks,


Why this post?
I'm interested in knowing some of your experience about layout automation. Obviously the good ideas, but also the bad ones (like don't go this way, it's a waste of time) and some possible new areas to be explored. 

 

Let's be honest, I'm not a pro at scripting, by far, but I'm eager to learn. That's a start I guess.
I understand that a good scripter should not only know the coding part, but also apply the best strategy to get to his goal. I believe it's rather easy to write "some" code that works (oversimplified, I know) it's another story to "know what to write" and understand what are the best tools and the structure that should be put in place.

That's why I'm asking you.  For pieces of advice, respectfully.

 

What is my project about?
I'd like to build routines and scripts to give me a hand at making layouts of books of hundreds of pages.

The end game is not to have something 100% automated, but rather a tool box and a routine that can help speeding up the layout process, saving time, saving costs etc.


I've got in my hands :
- 1. A word file. Text is tagged and has already some styles set up. Tags encapsulate the mains sections.

- 2. A "template", being an indesign file with all the design (Masters / graphics / Styles etc.)
- 3. No urgency. Time is at my side. No stress here… but I won't sleep until it's done… 

 

My understanding so far

- I can not hope to make magic out of Extendscripts only.

- Indesign servers are meant to achieve such things. But cheap solutions are of the essence. It's a no go then.

- Plugins and C++ coding could help me at some point. That goes deeper in ID objects management. I'm not afraid of going there if really needed (ignorance is bliss, isn't it?)

- I need better understanding of how I can handle objects in ID via scripting

- UXP scripting for ID is still lagging behind in terms of possibilities compare to Extendscript (so far, in 2025)

- IdExtenso could help me out and I need to get to know it more.

- No Data merge tools are relevant here. No variables are needed.

- Typefi free tools for textframe adjustments will be helpful (https://www.typefi.com/autofit/)

 

My questions

- What is the main strategy I should focus on?

- Can I aplpy Masters based on content, then cut texts, place Textframes in specific positions?

- Can I place a picture based on a tagged text with (name of picture), and create a strategy of position depending of the dimensions / ratio HxL of the pic? 
- Is it possible to adjust the textframes depending of the Master applied, after the text has been deployed?

 

My current focus.

- Scripts for cleaning the text

- Interpreting/ changing Word styles to ID ones.

- Creating formating rules to apply ID styles to specific paragraphs

- creating side scripts that serve as tools for complex local formating that can't be done on a large scale

 

 

Thanks for you patience and to the ones that would be happy talking about that topic

 

Fred.L

7 replies

Fred.L
Fred.LAuthor
Inspiring
July 9, 2025

Hey there,
The strategies are starting to pay off.
@Eugene Tyson  
Thank you very much for having opened the door to a fantastic playground. I can't thank you enough for helping me get started.


I managed to script quite a few things, moving from micro to macro slowly but surely.
I'm not sure whether the hardest part is done or if it's just the beginning, but I feel it's going the right way.

 

Find attached a small screen recording of where I am at the moment. The next step will be dealing with textframes, auto-anchoring objects to paragraph styles, and some other fun stuff.

 

For those who might be even slightly interested in the structure I've built and for those lucky ones who might have a deep knowledge in such things and would be nice enough to comment:
- Thinking Macro to get a rough idea of where I want to go. No big one-click-voilà! button. Build brick layers that can be independently adjusted, updated. Ultimately, having a Script runner that proposes a sequence of several scripts put in order. This runner will handle a variety of presets, and the scripts will be either run once at a time or all at once.
Part 1: The text formatting
- I started from the ground up, thinking Micro first. The idea is to isolate small tasks, script them, and make sure the formatting can be handled.
- Moving up, thinking about relevant text sections. Create scripts that can run a handful of smaller scripts in batch to deal with consistent groups (like in the screen recording).
- Moving wider and dealing with the other groups of tagged texts.
- Adding anchored graphics to texts (ID vector objects with script labels or XML tags, not sure which is more relevant). 
Part 2: The frames

- Create object styles that will be the foundation of the position of the frames (and for easy manual post-processing).
- Create/Anchoring/ Move new textframes while extracting paragraph content (thanks to XML tags).
- Create scripts that apply scenarios, depending on parameters like presence of graphic sizes and their size, table, margins, etc.
- Apply the correct Masters  upon content.

Community Expert
July 9, 2025

Thanks for the follow up - it looks great, well done.

Inspiring
May 7, 2025

In addition to all the other great comments here (from some real experts in the field!), you might also want to look at TypeFitter from Typefi. It's a big time-saver for books in particular - for automatically fixing all sorts of issues with your copy.

 

https://www.typefitter.com/

 

(Full disclosure - I wrote the original version of it, but I'm not involved in it now, other than as a fan.)

Fred.L
Fred.LAuthor
Inspiring
May 7, 2025

Hey Lawrence,

Thanks for your reply

Typefitter sounds quite interesting. Thanks for the tip. I'll have a look and see if that can be used as a replacement of the scripts I've got in hands ^^

Fred.L
Fred.LAuthor
Inspiring
July 9, 2025

Mike Witherell
Community Expert
Community Expert
May 7, 2025

Your question and discussion brings many thoughts to mind:

 

AI, so far, cannot do any page layout work. I marvel at that.

 

More practically, since you mention you have "tagged text" then you might be interested in reading a free guide that Adobe published named "InDesign CS4 Tagged Text Guide" last updated in 2009. Since that feature hasn't changed, the info in this guide should be good to work with. I know of no other newer guide (if you do know of a newer version, let me know).

 

Another thing to ask yourself: Are you familiar with all the automation methods that already exist within InDesign? There are currently, by my count, 34 different preset automations that you can call upon to automate what you do. Simply understanding paragraph styles thoroughly is half the automation battle.

 

Scripts are fantastic. I think the one I use the most consistently is among the pre-installed scripts from within Adobe InDesign: "Find/Change by List". Over the years, I have improved that flawed script so that it can clean 3X the number of typesetting issues as the original script, all without harming any typesetting already done. Of course, anyone familiar with GREP and F/C routines can do that since the script is meant to be editable anyway. When typesetting is scrupulously clean, you gain the benefit of saving time in the editing cycles (the slowest part of what we do; yet the most important).

Mike Witherell
Fred.L
Fred.LAuthor
Inspiring
May 8, 2025

Hey Mike, 

Thanks for the reply.

 

>>> Since you mention you have "tagged text," then you might be interested in reading a free guide that Adobe published named "InDesign CS4 Tagged Text Guide."

Thanks a lot for that. I didn't know something like this existed. I'll have a look.

As I mentioned above, I may have used tagged text in a naive way. Real text tagging is for now a bit overkill for what I want to achieve. I'm not sure it is relevant at this point to have that level of control on the text. I want to keep everything as natural as possible, and I consider MS Word documents as raw material and ID being the manufacturer that will polish the text. Still, I admit needing some more information than just raw texts without any kind of styles and tags. We'll see how it goes with that strategy soon enough ^^

 

>>> Adobe InDesign 2025 tour of 32 presets, styles, automations

Thanks for the tip. Didn't know about this one either ^^

I'll have a look. I don't know what I should expect from it though. Any personal insight you'd like to share?

I back up my ID profile regularly, meaning I hold on to many presets already.

Besides, Keith Gilbert did an amazing job listing all the settings that we could gather via scripting. Once adapted to your workflow, fear of setting up again the data is gone.  (https://gilbertconsulting.com/scripts - See setup script)

 

>>> Find/Change by List

Thanks. I actually know that script very well. I've used it a few times, but it is probably one of the reasons I went to using the Query manager from P. Kahrel (https://creativepro.com/files/kahrel/indesign/grep_query_manager.html)
So much more we can do with it, faster, more versatile, edit queries on the fly, create & save groups of queries. A marvel.

Dave Creamer of IDEAS
Community Expert
Community Expert
May 7, 2025

...

My current focus.

- Scripts for cleaning the text

- Interpreting/ changing Word styles to ID ones.

- Creating formating rules to apply ID styles to specific paragraphs

- creating side scripts that serve as tools for complex local formating that can't be done on a large scale

...

Most of this can be accomplished without scripts.

-Word macros can clean up the text. While the macros are scripts, the macros can record your actions, making their creation and editing much easier.

-InDesign has the ability to save the Word paragraph and character styles to ID styles, so import is fairly easy. I do recommend you select all the Word text after importing and removing overrides. 

(You mentioned tagging the text--some people use this as a term for applying styles. ID does have a tagged text feature too. Can you clarify your terminology?)

-If you apply your styles in Word, you shouldn't need to do much else. However, it is not always practicable to format everything in Word. For that you can use the free plug-in to so some find/changes: 

https://www.automatication.com/product/mfc/

-With nested styles, GREP styles, next styles automation, most of the complex formating can be handled automatically. The find/change can usually deal with everything else.

 

David Creamer: Community Expert (ACI and ACE 1995-2023)
Fred.L
Fred.LAuthor
Inspiring
May 8, 2025

Hey Dave,

Thanks for the reply, much appreciated.

 

>>> Most of this can be accomplished without scripts.

Well, I didn't provide any example to illustrate my point, but I can assure you MS Word cannot do most of what I'm implementing with ID scripts. There are just too many things belonging to ID properties. I've got many Grep queries for cleaning up the text, and Clearing overrides is indeed not an option, it's just mandatory.

However, I totally agree about macros being useful in MS Word. As a matter of fact, we use them. I provided a bunch of macros (and the procedure for installing them as buttons on the ribbon) and not enjoyed so much the fact that VBA Mac & PC are not 100% compatible, despite being the same language. For a few of the macros, I had to make a special PC compatible version (I'm on Mac, as you figured). So annoying.

We use Macros only for running check-ups and bring valuable pieces of information though. Verifying the presence and integrity of tags (open/ close properly), illustrations not appearing multiple times and using proper structure (Like not jumping from Heading 1 to Heading 3 - ID Toc and PDF Bookmarks not being very good at dealing with such things), tags for future Xrefs … and so on.

We experienced that at the end of the day, authors/ writers should focus on the content, not too much on the format. Providing tools to help them do a full check-up on their document is as far as we can go.

 

>>> You mentioned tagging the text--some people use this as a term for applying styles. ID does have a tagged text feature too. Can you clarify your terminology?

 Good point, I may well be using the word the wrong way and confusing people.

I'm using the expression of tagged text to identify blocks of paragraphs in the document, parts that I need to be tagged in for a later use, somehow, in ID.

I'm in the boardgame industry, and books are closer to a technical user manual than a novel. Parts of text are technical-oriented (and need to be formatted a certain way), some others are sidebars, text in margins, etc. Tags are essential to identify where the texts are supposed to go. It is not as thorough as an XML file (this could be done though, sure), but it's good enough. In conjunction with paragraph styles, a MS Word file can already bring a lot of information.

 

I very well know about Multi/ Find Change. It's a great tool when it works. I've used it for about 2-3 years, but the plugin can be a temperamental child at times. And you can only install it a certain number of times (when you can. Sometimes, you cannot validate the license). After that, you have to purchase it again. I'm working on 3 Mac computers, and I clean install the OS at least once a year, change the hardware in between… well, the way the plugin is shared doesn't work for me anymore.

 

>>>nested styles, GREP styles, next styles automation
- Nested styles. I try to stay away from nested styles. They pretend to be your friend, but broad solutions on a 200+ pages document are usually not good solutions, speaking from experience there. In the end, I don't see the point of using them. Grep styles can do the same and much more. So why bother?

- Grep styles are nice if you use them carefully, more versatile.  

- Next styles automation is great, especially (if not only) in conjunction with object styles. You can automate the formatting of a lot of stuff once you put on a specific pattern on the table. (thanks CreativePro https://shorturl.at/56Plg)

 

Fred

Community Expert
May 7, 2025

Really enjoyed reading your post. It’s refreshing to see someone diving into automation not with the goal of pushing a magic button, but building a toolbox that helps speed things up while keeping control over the design. That mindset alone will save you from a lot of the headaches that have tripped up many along the way.

 

You're already off to a solid start: having structured Word files with tags and a clean InDesign template is half the battle. The real wins come from having a clear workflow in mind, then building your scripts or tools to serve that workflow, rather than the other way around. The ability to step back and ask “what’s the smartest way to get from A to B?" - perhaps it's a script, perhaps it's building solid InDesign Templates, or working in a book file so you can sync all your styles. 

 

A few thoughts from experience

 

Start small, script often

I have a built up a library of building blocks of scripts over the years. Some grafted from other scripts, some built with limited knowledge and a can do attitude (although many times people have helped me and shown better ways to do it which is fantastic).
When the goal seems complex, break things into small repeatable tasks. Scripts that do one job well like cleaning up Word junk, mapping styles, or tagging images are more useful (and easier to debug) than some beast of a script trying to do it all.

Build up your toolbox in layers.

 

Lean into tagged structure
You mentioned your text is tagged. Brilliant. That might open up a lot of automation potential from applying Parents, to placing images, to deciding where content lands on the page. If your tags follow a pattern, it could drive layout decisions.

 

Parent pages
You should be able to apply Parents based on tagged content and it might be worth testing. For long books, that alone can shave hours off. Just make sure your Parents are well structured, named frames, predictable guides, consistent styles etc.

 

Images: think in ratios, not just names
Placing an image based on a tag like “(Image:Name)” works great when paired with logic that checks the image’s dimensions. Portrait? Goes in the sidebar. Landscape? Full width maybe. Thumbnail might be top left text frame. Build rules based on image shape, not just filename. It’s smart and scalable.

 

I don't know much about InDesign Server or plugins
Perhaps you're right to skip InDesign Server for now. Unless you’re building a web app or a large-scale publishing system, ExtendScript should be more than enough. C++ or UXP might come later but for book layout automation, ExtendScript is still probably your best bet.

 

Post-layout tweaks are totally doable
Yes, you can adjust textframes and layout after the text is flowed. That’s often where the finesse comes in. You've already fond the Typefi tools can help with frame resizing and overflow fixes but you can also roll your own little frame fitters or balancing scripts.

 

Best advice - stay modular - as said before
It's easy to overlook, avoid making one mega-script. Instead, build little helpers. One for cleaning text, another for applying styles, one for images, one for layout tweaks. That way, you can test each step, reuse them, and mix and match.

I'd say your current focus is exactly where I’d start. Clean the input, standardise styles, build rules, and only then look at layout automation. The fewer surprises in your base content, the more confidently you can automate the rest.

 

If you haven’t already, look at Marc Autret’s work on Indiscripts, Peter Kahrel, Tomaxxi, not sure who else (sorry not naming dropping anyone else brain is fried) -  all have a good library of scripts (I tend to find with searching the internet) and there are some of the JSX examples floating around the community they’re great for learning how to think strategically in scripts, not just code mechanically.

 

Happy to chat more as you go let us know how you get on.

 

All the best

Dave Creamer of IDEAS
Community Expert
Community Expert
May 7, 2025

@Eugene Tyson I didn't see anything in the tagged text manual about page structure, including parent pages. It was all text and table formatting. Do you have information on other tags?

Personally, I found tagged text most useful when getting text from a database and exporting with the tags. I don't think I would bother for existing Word documents. 

There is a add-on that lets you apply parent pages based on paragraph styles (and object styles) at:

https://www.id-extras.com/products/mastermatic/

 

David Creamer: Community Expert (ACI and ACE 1995-2023)
Community Expert
May 8, 2025

Thanks Eugene for sharing these 2 pieces. I kind of feel it's Christmas now…


I'll be honest, I've never used this tag panel before. Now, I've just read a few things about it and I already understand that tags can be applied to almost everything. Texts, tables, objects, graphics, etc. This is great. Since I can even apply tags via F/C queries, they can be applied very quickly, obviously via script as well.

In short, now, I've got quite a few toys to play with and I'm ready to build a strategy for doing a proper layout.

Thank you very much. You helped me get to the next level ^^


Excellent - no problem at all - just a few ideas to increase the automation. 

 

I've had several magazines/books/reports that require the additional push of parent pages, and doing it manually was a pain especially with text reflow. 

 

Basing Parent Pages on styles used in the document is a great idea, but sadly not implemented. 

So we can push the parent pages with scripts. 

 

It could definitely do with some fine tuning to catch all. But as always, proof of concept is better than wondering.

rob day
Community Expert
Community Expert
May 7, 2025

Hi @Fred.L , You can browse the ExtendScript API here:

 

https://www.indesignjs.de/extendscriptAPI/indesign-latest/#Document.html

 

Fred.L
Fred.LAuthor
Inspiring
May 7, 2025

Hey,

Thanks for your reply. I 've kind of gotten to that page everyday for the past two years ^^

Sooo useful, can't be overlooked

Robert at ID-Tasker
Legend
May 7, 2025

In short - pretty much everything you can click in the InDesign - you can do through scripting. 

 

There are some Dialogs that can't be accessed / controlled through scripting - but they still use the same properties and do the same operations that are available through scripting.

 

Fred.L
Fred.LAuthor
Inspiring
May 7, 2025

Hey Robert,

Thanks for the reminder, I certainly agree with you. Sometimes, it's even the other way around. Some properties well hidden are sometimes discovered and brought under the light by our notorious experts, like M.Autret with stylighter. (just an example from the top of my head)

I would then say that what is provided by ID can be manipulated via scripts, but some many others things too.