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

InDesign Live Captions GREP styles (remove prefix & suffix from name)

New Here ,
Apr 11, 2020 Apr 11, 2020

Copy link to clipboard

Copied

Hello, I found the post about removing the file extension at the end of a live caption, but I am also trying to remove a number followed by a period at the beginning. My client shares photo files with this naming style: "1. Caption of image is written out here.jpg". The numbering goes from single to double digits, and is always followed by a period and a space. I am trying to automatically remove the number, period, and space at the beginning as well as the file extension at the end, while keeping the middle bit as my live caption. Any suggestions?

 

Thanks!

TOPICS
How to

Views

2.1K

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 ,
Apr 26, 2020 Apr 26, 2020

Copy link to clipboard

Copied

I'm not a from-the-top-of-my-head GREP formulist, so you have to do some tinkering yourself.

Because I did find many articles discussing some GREP sequences in a comprehensible manner.

Simply Google "indesign grep delete characters" and they tumble over your screen, like this one:

https://indesignsecrets.com/indesign-grep-essentials-how-to-add-delete-and-re-arrange-text.php

Note: you can't assign a GREP Style to edit a text, but you can let GREP do it in Find/Change.

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
Enthusiast ,
Apr 26, 2020 Apr 26, 2020

Copy link to clipboard

Copied

As Peter indicated, you can't delete characters with a GREP style; however, you can hide them if that's a solution that works for your project.

 

1. Create a character style with a Size of 0.1 and the Character Color set to None.

Screenshot 2020-04-26 13.40.38.png

Screenshot 2020-04-26 13.40.46.png

 

2. In your caption paragraph style, in the GREP Style pane, create two GREP styles applying the character style using the following GREP patterns:

^\d{1,2}\.\s

\.jpg$

Screenshot 2020-04-26 13.42.32.png

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
Enthusiast ,
Apr 26, 2020 Apr 26, 2020

Copy link to clipboard

Copied

Guess I should test before posting, as the solution above will only work if the Live Caption is converted to a Static Caption. InDesign sees the text in Live Captions as a single entity, not as individual characters.

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 ,
Apr 26, 2020 Apr 26, 2020

Copy link to clipboard

Copied

I would add one more attribute: Horizontal scale 1%.

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 ,
Apr 26, 2020 Apr 26, 2020

Copy link to clipboard

Copied

Nice, all these tips ! That should get the ball rolling' 🙂

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
Guide ,
Apr 26, 2020 Apr 26, 2020

Copy link to clipboard

Copied

Hi!

 

Surely the kind of answer [David's one] I would have given years ago, but not now anymore! …

 

Go to Bridge, open the images folder and updating, e.g., the "Title" metadata with this kind of Grep treatment:

 

"Title" (metadata) = Filename.replace(/^\d+\.\s/, "").replace(/\.\w+$/, "") (metadata)

 

See the screenshot: filename = "2. Photo_ZZZ.JPG" ==> title = Photo_ZZZ

 

Capture d’écran 2020-04-27 à 00.27.13.png

 

[1 click!]


Come back to InDesign, select all the links in the Links panel and update them! [idem]

 

That's all: All the captions are still "live", no "static" at all!

 

(^/) The Jedi

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
Enthusiast ,
Apr 26, 2020 Apr 26, 2020

Copy link to clipboard

Copied

Hi Michel,

 

That's a cool trick. However, I could not get it to work. I'm getting the literal text from the Title field. I tried some variations of the code string in the event that I'm misinterpreting what should go in the field, but no luck.

Screenshot 2020-04-26 21.56.46.png

Screenshot 2020-04-26 22.01.02.png

Screenshot 2020-04-26 22.01.40.png

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
Enthusiast ,
Mar 02, 2023 Mar 02, 2023

Copy link to clipboard

Copied

LATEST

I'm also curious where to input this:

"Title" (metadata) = Filename.replace(/^\d+\.\s/, "").replace(/\.\w+$/, "") (metadata)


From what I see in Bridge, there is no way to edit the metadata from batch rename, and the notation in the solution would indicate Javascript. Trying to find a dynamic solution that involves little knowledge of InDesign for template distribution.

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