×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

DataMerge and Scripting Question.

DataMerge and Scripting Question.

DataMerge and Scripting Question.

(OP)
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  

RE: DataMerge and Scripting Question.

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

RE: DataMerge and Scripting Question.

(OP)
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
 

RE: DataMerge and Scripting Question.

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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close