3 Replies Latest reply on Aug 19, 2008 1:15 PM by (Keith_Cooper)

    Text Variable

      In my regular day to day work, i need to a change a unknown text frequently in indesign doucument. for example, i have two product numbers in the datasheet that need to be changed. but the product number in the documnet is not known to me. If i create two variables and place the product numbers in the variable. can i use VB to get the variable data in the text field and do find and change. if i do find and replace, i guess the variable is converted to text. can anyone help me find the solution.
        • 1. Re: Text Variable
          Level 1
          If you're using a Text Variable to define the product number, then what are you finding/replacing? Just change the definition of the text variable.

          Dave
          • 2. Re: Text Variable
            Level 1
            hi, how do i do it using VB. I defined two text field for each prodcut in the VB. can you help me providing the script to change the definition of the text variable.
            • 3. Re: Text Variable
              If you're changing more than a couple of small pieces of text, it might be easier to do a XML merge. If the changes you're making are more minimal, you might be able to write the variable's value (text) directly to an existing text frame. I've never done this (I'm new to scripting ID myself), but it sounds plausible. Lastly, you should be able to automate a search-and-replace if you only want to replace the product number throughout the document. I don't have code for any of this, but if you look through the ID object model (see a thread that I started regarding this for resources) you should be able to find what you need.

              Be aware also, that if you use the search-and-replace approach, and you're replacing a "dummy" or "placeholder" value, the second time around that placeholder will have been replaced with the "live" data--so it won't work twice, unless you're working from some sort of "template" document which you're re-saving to a different filename.