Use document name without extension and a grep question
Learn / Forums / General InDesign Topics / Use document name without extension and a grep question
Tagged: GREP, variable text
- This topic has 17 replies, 4 voices, and was last updated 6 years, 6 months ago by Michel Allio for FRIdNGE.
-
AuthorPosts
-
-
September 13, 2017 at 7:37 am #98044Dimitri De BruynParticipant
Hi everybody
First question:
I want to use my document name as leading for a revision number on the back.for example:
DEM0010-REV C_example document.INDDand I want to have DEM0010-REV C at the end of my document printed on the last page as a reference.
I used ‘Variable text’ and a nested style. But nested styles don’t work with variable text.Is there another way to do this?
2nd question:
In the same document I need to write the word ‘implant’ or ‘implants’ with a capital.
When I used Search and replace it is no problem, but it changes the word ‘implantation’ ass well.
So I think i need to use grep for this, but I cannot find the right expression.Can someone help me please?
Thanks
Dmitri -
September 13, 2017 at 8:05 am #98045Graham ParkMember
Set up as a GREP in the Paragraph Style, this way as you type the formatting will be added,no chance of missing any of them.
Make a Character Stye for case ALL CAPITAL
Set the GREP
Apply Style CAPS
(?=implant)i-
September 13, 2017 at 10:46 am #98059Dimitri De BruynParticipant
@graham-park thanks it works great, but it also works on implantation and justimplant.Even though justimplant is not a real word. Do I have to make an exception grep style?
-
-
September 13, 2017 at 3:29 pm #98066Graham ParkMember
Sorry I stuffed that up.
This one will work better and will get most instances.
If you have punctuation other than comma or fullstop this will not work.
Other punctuation would have to be added after a BAR separator.(?=implant[\s|s|]\.|\,)i
-
September 13, 2017 at 4:38 pm #98071Graham ParkMember
This adds some more punctuation options to the GREP
This GREP is a Positive Lookahead(?=implant[\s|\[|\\|s|\:\.\,])i
For punctuation add each with a BAR separator and a leading \ otherwise they will not been seen as a character
For additional punctuation add them as followseg |\{
-
September 15, 2017 at 4:04 am #98110Dimitri De BruynParticipant
Thanks @graham-park
final code:
(?=implant[\s|\[|\\|s|\:\.\,|\{])iThis code will cover the most. And it will do the job just fine.
But I want to be sure to cover all possibilities. And if there is one possibility that could happen it is (implant) or ‘implant’ betweenSo i added “|’|\(|\)
(?=implant[\s|\[“|’\(|\)|\\|s|\:\.\,|\{])i
-
September 15, 2017 at 6:27 am #98113Dimitri De BruynParticipant
That’s a very nice code :thumbs:
-
September 15, 2017 at 7:28 am #98117Dimitri De BruynParticipant
Yesss.. that’s the one I had in mind. Thanks @kimmi-patterson
So problem 2 is solved..
Now I need a solution for problem 1 :)
-
-
September 15, 2017 at 5:27 am #98111Graham ParkMember
That code is a bit inelegant.
This is better use POSIX to shorten it and it will pick up all punctuation without a list.(?=implant(s|[[:punct:]]))i
-
September 15, 2017 at 5:42 am #98112Graham ParkMember
Sorry missed the space
(?=implant(s|\s|[[:punct:]]))i
-
September 15, 2017 at 6:49 am #98114Kimmi PattersonMember
You could also use Word Boundary in Locations, which will only find instances where implant(s) is the whole word. Then it wouldn’t matter what precedes or follows:
(?=implant(s*)\b)i
Hope this helps!!
-
September 15, 2017 at 7:18 am #98116Graham ParkMember
That is a nice solution.
As to Dmitri first question about the revision name on the back of the using ‘variable text’.
InDesign treats these type of items as a single character so no GREP, editing, formatting to part of the result are possible.I don’t think it is possible to do anything unless you convert the ‘variable text’ to text.
-
September 15, 2017 at 7:34 am #98118Kimmi PattersonMember
Agreed on editing variable text. However, there may be a sneaky way to style with GREP or nested styles using the location of the variable text.
For example, if the file name variable is the first character of the paragraph, a nested style could be applied to the first word, which would be the file name variable.
Let us know how the variable will be used and we may be able to help :)
-
September 15, 2017 at 7:40 am #98119Graham ParkMember
Yes a nested style can be applied to the whole variable text but not to part of it.
InDesign treats these type of items as a single character so no GREP, editing, formatting to part of the result are possible.
Dimitri can you post exactly what the variable text is and then how you want it to appear?
It looked to me as though you wanted to remove part of the file name when it is placed. Or do you just want to format the result? -
September 18, 2017 at 6:54 am #98165Dimitri De BruynParticipant
Hi
It was a long weekend.. sorry for the delay..
Anyway.. my document name is DEM0010-REV C_example document.INDD
and I want to print DEM0010-REV C at the end of the brochure.I tried it with nested styles, after the underscore the color of the font would be none.
But it doesn’t work with variable text, unless I convert it to normal text.I use the variable Documentname
[url=https://flic.kr/p/YxAZow][img]https://farm5.staticflickr.com/4336/37113617246_34fcf656bc_c.jpg[/img][/url][url=https://flic.kr/p/YxAZow]Screen Shot 2017-09-18 at 16.02.22[/url] by [url=https://www.flickr.com/photos/dimelot/]Dimitri de Bruyn[/url], on Flickr
-
September 18, 2017 at 7:07 am #98168Graham ParkMember
InDesign treats the text variables as a single character so you can only apply formatting to the whole string.
As InDesign treats variable text as one character you can get some strange effects if the text box is too small, try it make the text box very short and see how the characters sit on top of each other, the text will not wrap to more than one line etc.The only way around this is, as you say, to convert it to text, then you can format it the same as any other text.
-
September 18, 2017 at 7:12 am #98169Dimitri De BruynParticipant
Does this image work?
@graham-park I knew this, but I hoped for an solution.. Too bad.
If I convert it to text and the revision changes it does not change in the document..
-
-
September 18, 2017 at 8:51 am #98172Michel Allio for FRIdNGEParticipant
Hi,
Take a look to this video!
The captions use metadata played as variables!
The op needed to create a list [TOC] of the captions!
The result was a “nice mess” [ID bug]!So, I’ve taken the bug and sit on it! …
The captions are always “dynamic” [variable links]!
In your case, you just need a small script! … [Not for free!]
(^/) ;-)
-
-
AuthorPosts
- You must be logged in to reply to this topic.