Skip to main content
OsakaWebbie
Inspiring
March 21, 2024
Answered

Global find/change - save steps?

  • March 21, 2024
  • 2 replies
  • 1217 views

I have a process where I import a large amount of plain text exported from a database in multiple ways (alphabetically with all contact info, names grouped by city, names grouped by organization, etc.) for a directory. My export from the database includes distinctive bits I can find easily in InDesign with global find/change, so that I can replace them with paragraph styles and character styles. But doing all the find/change operations by hand is slow, so I'm wondering if there is a way to automate it at least a little.

 

Small example snippet from my geographical listing (names changed for privacy):

 

#KEN##GEOJ#秋田県#GEONJ# Akita-ken 1
#SHI##GEOJ#横手市#GEONJ# Yokote-shi
SMITH, Cindy
#KEN##GEOJ#青森県#GEONJ# Aomori-ken 20
#SHI##GEOJ#青森市#GEONJ# Aomori-shi
ADAMS, Stephen & Kimiko
JONES, Luke
MCDONALD, Paul & Sara

 

#KEN# and #SHI# indicate a paragraph style to apply ("Geo prefecture" and "Geo city"), and #GEOJ# and #GEONJ# indicate the beginning and end of a character style ("Geo Japanese").

 

Yes, I can manually do the necessary operations (text searches for the paragraph style ones and a GREP search for the character style), and I did that for some parts of last year's directory. But the number of needed searches has increased this year, and it will be hard to remember from year to year how to do the searches (especially GREP). Is there a way to automate it? I don't mind scripting, although I'm new to scripting in InDesign.

This topic has been closed for replies.
Correct answer Robert at ID-Tasker

@OsakaWebbie 

 

The best way would be if you style sample text - then Export it as Tagged Text - and then analyse how it looks like.

 

Tagged Text needs proper encoding:

 

and header:

<ASCII-WIN>
<Version:19.3><FeatureSet:InDesign-Roman><ColorTable:=<Black:COLOR:CMYK:Process:0,0,0,1>>
<DefineCharStyle:Character Style 1=<Nextstyle:Character Style 1>>
<DefineParaStyle:NormalParagraphStyle=<Nextstyle:NormalParagraphStyle>>
<DefineParaStyle:Paragraph Style 1=<Nextstyle:Paragraph Style 1>>
<ParaStyle:NormalParagraphStyle>Optati quam sitas simus vollatur a enihill itatquia sit la nus modit, aliquae. <cTypeface:Bold>Nam nobis dolec<cTypeface:>ae paribus ea ent etur? Non repreptatque conecta sperum facessuntus, con numque venem ium auta qui tem latem rae dit, officae. Ut enem. Liae. Ditat.
<ParaStyle:NormalParagraphStyle>Re, ut <CharStyle:Character Style 1>experferist<CharStyle:>, ut eost, explam id qui verunda id ut abor sit landi autessi aut enia ventia nam, omnissit ma porerum duciatem ut eveligenime reptas 
<ParaStyle:Paragraph Style 1>ipsapicae. Nequam quo blab inctemposam ex explitia quia doluptatem iusam fugia volut laturit audigendi dollabo remped eveliquae eicia verrum volesserum ut labor abo. Fugiassimet magnis ipsusandi dolo modi

 

2 replies

Eric Dumas
Community Expert
Community Expert
March 21, 2024

the 2 options I see, depending on the design you are creating:

The idea is to bring the text in your design and let InDesign take over the formatting because you set it to do it correctly.

OsakaWebbie
Inspiring
March 21, 2024

CSV would be overkill, and it would be challenging to write additions to my export code to create all the right delimiters and escape everything that shouldn't be regarded as a delimiter (commas, quotes, line feeds, etc.).

XML appears similar to the "tagged text" concept @Jeffrey_Smith suggested but more complex. If that's necessary, I'll try it, but I looked through the help page you linked and felt overwhelmed - in fact, I was already lost at the first sentence: "After you import XML data, the imported content appears as elements (the basic building blocks of XML) in the Structure pane." I've never seen a Structure pane (and don't see anything like that in the Window menu) and don't know how I would place a file so that it goes there.

Robert at ID-Tasker
Legend
March 21, 2024

@OsakaWebbie 

 

It's in VIEW:

 

 

But XML also would be overkill.

 

Try preparing your text and then export as TaggedText - and check contents.

 

Community Expert
March 21, 2024

Where in the process are your pseudo tags: #KEN# and #SHI# injected into the data? If this occurs on the data management side, can the system generate a custom tag?

If so, could the system generate a tag like this: <ParaStyle:address> ?

If so, you could use a Tagged Text Import where the formatting is completed on import.

OsakaWebbie
Inspiring
March 21, 2024

Yes, I have complete control over the pseudo tags - I'm the one writing the code that exports the data from the database. Searching the web for "InDesign Tagged Text Import", the newest relevant thing I found was a PDF for InDesign CS4 that was linked in an answer in this forum conversation, which claims the tag format was still the same as of 2018. So as a first test, I tried it with my simplest section, which uses two paragraph styles and no character styles. My text looks like this (names obfuscated for privacy):

<ParaStyle:Org heading>A3.MP
<ParaStyle:Org listing name>ADAMS, Robert & Linda
<ParaStyle:Org listing name>BARTMAN, George & Barb
<ParaStyle:Org heading>AABFG
<ParaStyle:Org listing name>DAVIS, Bernard

The PDF's instructions for importing the tagged text are the same as any other Place:

  1. Open the document into which you will place the tagged text, and choose File > Place.
  2. Locate and select the text-only tagged file.
  3. If desired, select Show Import Options.
  4. Click Open.

But no processing of the tags happens. What step am I missing?

Robert at ID-Tasker
Robert at ID-TaskerCorrect answer
Legend
March 21, 2024

@OsakaWebbie 

 

The best way would be if you style sample text - then Export it as Tagged Text - and then analyse how it looks like.

 

Tagged Text needs proper encoding:

 

and header:

<ASCII-WIN>
<Version:19.3><FeatureSet:InDesign-Roman><ColorTable:=<Black:COLOR:CMYK:Process:0,0,0,1>>
<DefineCharStyle:Character Style 1=<Nextstyle:Character Style 1>>
<DefineParaStyle:NormalParagraphStyle=<Nextstyle:NormalParagraphStyle>>
<DefineParaStyle:Paragraph Style 1=<Nextstyle:Paragraph Style 1>>
<ParaStyle:NormalParagraphStyle>Optati quam sitas simus vollatur a enihill itatquia sit la nus modit, aliquae. <cTypeface:Bold>Nam nobis dolec<cTypeface:>ae paribus ea ent etur? Non repreptatque conecta sperum facessuntus, con numque venem ium auta qui tem latem rae dit, officae. Ut enem. Liae. Ditat.
<ParaStyle:NormalParagraphStyle>Re, ut <CharStyle:Character Style 1>experferist<CharStyle:>, ut eost, explam id qui verunda id ut abor sit landi autessi aut enia ventia nam, omnissit ma porerum duciatem ut eveligenime reptas 
<ParaStyle:Paragraph Style 1>ipsapicae. Nequam quo blab inctemposam ex explitia quia doluptatem iusam fugia volut laturit audigendi dollabo remped eveliquae eicia verrum volesserum ut labor abo. Fugiassimet magnis ipsusandi dolo modi