1 Reply Latest reply on May 5, 2008 12:24 PM by (Olav_Kvern)

    Replace text with image

      Hi All-

      I'm trying to modify the FindChangeByList.jsx script so that it will replace text with images and was wondering if anyone has done this.

      Here's what I've added to the FindChangeList.txt file..

      image {findWhat:"[IMG::WebAssign.eps]"} {changeTo::"WebAssign.eps"} NULL Replace image

      I then added 'image' to the CASE within myFindChangeByList..

      case "image":
      myFindImage(myObject, myFindPreferences, myChangePreferences, myFindChangeOptions);

      Now the part where I'm stuck, I don't think I can use the myObject.changeText() like a text/text find and replace. Here's what I think I need to do..

      1. Find all instances of the string.
      2. Loop through all instances, placing the graphic (inline)
      3. Remove the text (if this can't be done when placing the graphic)

      Solutions? Suggestions?

        • 1. Re: Replace text with image
          Level 1
          Hi Wes,

          Take a look at the ReplaceTextWithGraphic.jsx script from the Scripting Guide script zip archive (available at the InDesign scripting home page mentioned at the top of the forum). The content of the myReplaceTextWithGraphic function ought to be pretty close to what you want.