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!
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.
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.
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$
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.
Copy link to clipboard
Copied
I would add one more attribute: Horizontal scale 1%.
Copy link to clipboard
Copied
Nice, all these tips ! That should get the ball rolling' 🙂
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
[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
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.
Copy link to clipboard
Copied
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.