Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DataMerge and Scripting Question.

Status
Not open for further replies.

TeamworkEr

IS-IT--Management
Mar 22, 2009
2
US
I am absolutely new to Java Scripting and have been away from programming for a number of year.

I am trying to data merge chacteristics of the data being merged. Is this possible?

A quick example would be to have a data source that has text for a simple text box (easy to merge) and other fields that contain the CMYK color values that I want that text to be in.

Can someone please let me know if this would even be possible in InDesign? If so, how hard a script is this to write?

Thanks in advance for the help.

Matt
 
Hi Matt,

There is a way and it doesn't take much programming.. :)

Indesign comes with an javascript with the name "FindChangeByList.jsx" (it can also be found on the CD)
You can let this script do several find/replace automatically. Even GREP is possible.
The script uses a text-file which states the FIND and what you want to REPLACE with. (there are several examples included)

Knowing this, you can use it for you solution.
1. In your case you should enter an code in the data-source which
specifies the color of the text.
2. You then have to make a character style which changes the
color of the character.
3. In the text-file you state find code.. and apply this character style.
4. Then remove the code, FIND code an REPLACE with "". Is another
line in the text-file
5. and your done.

or do you want to change the YMCK colors every time? because this is a different ball game...

i hope it is a bit clear...
i understand that you will have questions, because i did fly over the solutions. Please let me know if you have a question.
Marcel
 
Marcel,

Thanks for the reply. Forgive me for asking for a bit more of an explanation.

What I am exactly trying to do is to have a long data merge (1000 records or so) where I can specify the text that will be merged into a text box (easy) and the CMYK color value of that text.

Once the merge is completed, I will end up with a 1000 page docuement, each with it's own text in it's own color.

Does your solution apply to that?

Matt
 
Hi Matt,

i guessed you would reply ... because i did skip some detail to make my solution easier to understand... i guess i did skip to much.. :)

The solution i was gave was a way to colorize your text after you have done the data-merge.
With data-merge you cannot (not that i know of) color text.
So i came up with a trick, to make it work.

The script will do the coloring after you have done the data-merge.
1. in your source-data you place an code in front of the text.
Let say: [1]bla bla bla. The [1] is the code, which represent a color of
your choice (YMCK).
And [2]bla bla bla. where [2] represent another color.
2. After you data-merge all the text which needs to be colorized,
will have the code in front of it.
3. Then you run the script.
4. The script will find [1]+bla bla bla+[1] .. and apply the character style
which belongs to the [1] code.
5. The script will find [2]+bla bla bla+[2] .. and apply the character style
which belongs to the [2] code.
6. ect.
7. Then the script will replace the [1] with an "", removing the code [1]
in front of the text. Leaving the colorized text.
8. Also the other codes will be removed, [2] ect.

after running the script the 1000 pages will be done, and the text will be colorized.
i hope this is more clear.

I could look at you data-file and indesign template to make it more clear to you.
Marcel
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top