• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Dynamic Image Captions from Image Filename?

Engaged ,
Aug 16, 2023 Aug 16, 2023

Copy link to clipboard

Copied

Thanks again for all the help with my last project. It still has some bugs, but I am about to finish my ULTIMATE TEMPLATE with highly organized and uniformly applied Object, Paragraph, and Character Styles.. I just have a couple of questions before I am ready to use it.

 

Currently, I have a scanned image of a handwritten recipe that I place (with caption) in my content pages. Why on earth does InDesign have you manually place the caption after the image? I like my captions grouped with my images and was hoping they would just honor the caption style when you placed a new image. (I know put it in feedback).

 

I click the caption and then apply the appropriate Object Style to both the image and the caption, then group the two. I then have to edit the caption since, by default, it is the filename of the image (including the file extension). Is there any way to get it to drop the extension automatically? The Caption created when placing an image is a static caption. Is there a way to define a text variable that knows the filename without the file extension, so I could just create dynamic captions automatically?

 

After I get the recipe image and caption situated, I need to hide the caption. Since the layer information is not included in the Object Style (which seems really stupid) and since visibility is not a configurable option in Object Styles, I have to manuyally manage hiding the layer with the caption. Is there any better way to make the recipe name (image document name minus file extension) dynamically appear when an object sttyle is applied?

 

Also, do the caption settings pertain to each image or all images? If I setup a caption one way for one catagory of images (say photos) where I want the text centered and visible, can I setup the caption differently for other images using the Caption setup menu? How is that inormation stored/retreieved since its not listed in Object Styles.

 

And the final question...when generating a TOC, if you apply a Paragraph Style to the Title through your book (one TOC with title in every section), shouldn't you be able to use that Paragraph Style to create a TOC at the beginning?  So if I have 5 chapters that all have TOC (for their chapter) and the TOC is styled as chapterTitle, shouldn't I be able to then create a new TOC for the entire book that looks up all of the chapterTitle entries and provide a TOC based on their page numbers?

 

To solve the problem (unsatisfyingly), I manually set the chapter titles to generate tje TOC or the book. I was hoping it would do it all for me.

I'm excited to be wrapping this up so I can share it. Thanks again for all the help.

P.S. Just wrapping up the tenth printed copy of the latest version of the book. 
Can't wait to try it with my new template  Here are some pictures. Thanks again for all your help.


.Recipe BookRecipe BookContent SpreadContent SpreadTOCTOCCover (embossed using Cricut)Cover (embossed using Cricut)Index Title PageIndex Title PageIndex SpreadIndex SpreadPhoto PagePhoto PageSection StarterSection Starter

 

For some reason, the colors look terribly washed out in these pics. They are not in real life. The color is vivid.

TOPICS
How to

Views

876

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 16, 2023 Aug 16, 2023

Copy link to clipboard

Copied

The part with captions - can be easily scripted. 

 

The TOC - it's generated from the ParaStyle - not sure why it's not working for you?

 

Congrats on the printed version. 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 16, 2023 Aug 16, 2023

Copy link to clipboard

Copied

"Because InDesign's caption feature is a wonky, tech-bro system suited to fully managed publication environments and not much else."

 

There you have it.


┋┊ InDesign to Kindle (& EPUB): A Professional Guide, v3.1 ┊ (Amazon) ┊┋

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 16, 2023 Aug 16, 2023

Copy link to clipboard

Copied

Not sure what your issue with the TOC is. You can assign a style to each individual level of the TOC, with granular control of both the page number and the leader tab using Character Styles. You can even do 'phantom' variations of the same level by using different source paragraph styles. What more is it you seek?


┋┊ InDesign to Kindle (& EPUB): A Professional Guide, v3.1 ┊ (Amazon) ┊┋

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Aug 16, 2023 Aug 16, 2023

Copy link to clipboard

Copied

Basically, I was hoping to have the Section TOC (which lists hidden "Recipe Title" paragraph styles (see figure 1) where I would set the title of the section in the title of the TOC file (styled with "Section Title").

Figure 1 - Section TOC - Created by indexing only the Recipe Titles in each section.Figure 1 - Section TOC - Created by indexing only the Recipe Titles in each section.

 

Then, when all 10 sections had their own TOC styles that just indexed recipes in their section, I could go to the front of the book and generate a new TOC for the entire book. This table of contents would reference the "Section Title" paragraph styles just created for each section when I setup each section's TOC. (figure 2)
43eeb963-4705-46dc-bb29-7601cc47a91b.jpg

Then I also index the recipe names alphabetically for the entire book at the end in the Recipe Index TOC. (figure 3)

Figure 3 - Index TOC - Created by indexing all of the Recipe Titles alphabetically in the entire book.Figure 3 - Index TOC - Created by indexing all of the Recipe Titles alphabetically in the entire book.

 

The problem is that I could not reference the automatically created paragraphs using the "Section Title" paragraph style that the TOC function creates. Instead, I had to leave the titles for each TOC blank and manually add a separate frame with the manually entered name of the section to apply the "Section Title" style for the book TOC. I  wondered why the TOC generator can't reference the Section Titles created by the TOC generators for each section.


Thanks for your help again. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 17, 2023 Aug 17, 2023

Copy link to clipboard

Copied

In the TOC of the book you need to include all the styles you've used in the documents - plus the one that is the title for each TOC. 

 

You can't include TOCs as "already" generated blocks of text - you need to generate Book TOC "from scratch". 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Aug 19, 2023 Aug 19, 2023

Copy link to clipboard

Copied

I found the problem with indexing the styles applied by the chapter TOC that I generated. Some of the styles were getting duplicated between chapters. So one chapter would have Main > SectionTitle and another would just have SectionTItle.

By setting up synchronization and ensuring that only one SectionTItle Paragraph Format was used in all chapter documents, I could create the TOC entry for each chapter and allow it to title the TOC with the paragraph style SectionTitle. Doing this foir all 10 chapters+the final "Recipe index" allowed me to easily automatie the book TOC by simply indexing the SectionTItle paragraph styles across the entire book. In othoer words, I never have to manually enter the SecitonTitle elements for each chapter because they are automatically added by the TOC.

 

The problem I am having now is with adding js. When I generate the final index (alphabetic sort, full page, based on recipeTitles), I want to insert paragraphs every time the first letter in the  TOC entry changes.  I wrote the JS to do it in CodePen so that I could paste the resulting TOC text into a <div>element, push a button and copy the result (with the new paragraphs added at each change in first letter). 

I tried applying that to the InDesign DOM and running the script fromt he scripts panel but it didn't work. I don't have my VS Code debug environment setup and the documentation on Adobe Developer's site is sketchy at best. Lots of 404 errors, terrible useless example scripts, no explanation of how toi configure VSCode. So if you have nay pointers or know of any good sites that explain how to access the InDesign JS API, I'm all ears.

 

Also if you know how to insert a text varialbe that contains a calculation, (regex) that would be breat. I  can create captions for the recipe images and I can insert the filename variable, but it gives me the document filename (with or without an extension). But using the imageName variable doesn't give that option, it always has the extension. If I could remove the extension when definitng a text varialble, my project would be somuch better. Thanks in advance for this great discussion.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 19, 2023 Aug 19, 2023

Copy link to clipboard

Copied

Are you sure you are not mixing TOC with INDEX? You can't sort TOC... 

 

Hope this will help you:

 

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

 

I'm not JS guy so can't help you with coding. 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 19, 2023 Aug 19, 2023

Copy link to clipboard

Copied

Also, unless I'm misreading your description, it sounds as if some chapters have Paragraph Styles in style folders and others have them only in the main list or alternate folders. This organization has to be as carefully consistent across Book chapters as any other element of styles and settings.

 

That is, "Section Title" and "Main | Section Title" and "Headings | Section Title" are not equivalent things for sync and other purposes, and having mismatch and duplication is going to cause chaos.


┋┊ InDesign to Kindle (& EPUB): A Professional Guide, v3.1 ┊ (Amazon) ┊┋

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 19, 2023 Aug 19, 2023

Copy link to clipboard

Copied

LATEST

of how toi configure VSCode. So if you have nay pointers or know of any good sites that explain how to access the InDesign JS API, I'm all ears.

 

Hi @Jason Burnett , this is probably a separate topic, but most of us use this site for searching the JavaScript API—you can search for objects and easily get all of their methods and properties:

 

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

 

Adobe has discontinued Extendscript Toolkit, so you do need VS Code with the ExtendScript plugin in order to debug JavaScript. Here’s the install and setup page—see the Debugger Configuration for setting up the launch configuration for a folder of scripts:

 

https://marketplace.visualstudio.com/items?itemName=Adobe.extendscript-debug

 

I would start a new thread if you need more help on the VS Code setup.

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines