Script: Find and Replace Graphics version 2

ai cs3 logoToday’s script installment is Find and Replace Graphics version 2.

Download script (13k file size).

Please give this script a whirl. Email me with bugs or feature enhancements.

find and replace graphics version 2 demo movie screenshot

Watch a movie demo of the script with voiceover! (2.2 mb)

Important Enhancements:

  1. The find-replace objects now remain on their original layer. No more error alerts about locked layers.
  2. The find-replace object are now in the same z-stacking (object stacking) order as the original.
  3. "Replacing" master object is now deleted once it has replaced all the find objects. Turn this off by changing line 43: var deleteReplaceWithObj = false;
  4. Centered, non-scaled XY placement is default.
  5. If non-proportional scaling is desired change line 37 to: var scaledObject = true;

Future Work:

  1. Proportional scaling in X, Y, or weighted XY that is still centered on the original object’s center point.

To install new scripts you need to:

  • Quit Illustrator
  • Copy the files into the Illustrator application folder’s “Presets” » “Scripts” subfolder
  • After restarting Illustrator you can find the scripts in the menu “File” » “Scripts”;
  • TIP: You can create subfolders in the scripts folder to organize your scripts

Tags: , , , , , , , ,

14 Responses to “Script: Find and Replace Graphics version 2”

  1. jason says:

    Tried using this and get error:

    Error 25: Expected ].
    Line: 1
    -> subArray0["object]=[PathItem photoElement1]


  2. nick says:

    wow – this is exactly what I’ve been looking for. thank you!!

  3. fr says:

    Hello Nathaniel, i just tried your plugin with cs5, no success, but i didn’t take time to step in to see where it went wrong.

  4. Ken Pierce says:

    Wow, I didn’t really even know you could do much scripting in Illustrator let alone that you could use javascript. This is very cool. I was exporting some point layers for someone figuring they could just change the symbology, ha ha. I figured you could just search and replace symbols. Surprise my web search brought me here, to a cartography site. Excellent.

  5. Shaunt says:

    This is excellent! You have cut my work load in half!

    Do you know if you will be releasing any updates that allow you to replace multiple symbols with one symbol, such as road shields exported from ArcMap that come out as 3 separate objects (the outline, the fill, and the highway number all being their own objects)?

  6. Nathaniel says:

    @Shuant: I’ve gotten this request before, but the solution is still not optimal. You’d essentially be replacing an artwork group made of the fill, stroke, and route number text with a symbol for the fill & stroke portion and then a route number text object that’s grouped with that symbol. I think you could get similar results by isolating those route symbols groups on their own layer, ungrouping, select all the stroke elements and delete. Then select all the fill parts and run the existing scripts on them. Then select all the text pieces and move x-y till they line up over the new backgroups. Then if you wanted, regroup individual clusters.

  7. Alex says:

    Hi Nathaniel, this script is awesome! You saved me hours of work. Thank you so much! Keep up the good work.

  8. Excellent script! Mordy Golding sent me the link.

    Would love to see a version that let me swap two objects, seems a similar functionality to what you have here but I’m no script guru.

  9. Nathaniel says:

    @George: Glad you like it and thanks Mordy!

    Can you describe your proposed functionality with an example workflow, please?

  10. Let’s say I have three (non-symbol) objects (or object groups, specifically) in a line. Need to swap the first & third objects.

    In this specific case, they happen to all be the same size (button images). I had Button A, Button B and Button C. Client wanted the order to be C-B-A.

  11. Nathaniel says:

    @George: Check out John’s Swap Objects script at

  12. Excellent, thank you!

  13. california art…

    Script: Find and Replace Graphics version 2 « Kelso’s Corner…