Variable text search and replace it with another variable of text

Hi, I want to do the following with VB script.

Can someone help me?

I have a document with A text element and variable text B are defined.

And A variable text is used in the document.

1. search all the variable text from the document

2. replace A text elements for variable text B

3 Remove A variable text

Thank you.

erieru103

Hello

Ok. You have your point, sorry...

As I wrote - VBA do not know, but as JS, it could be like this:

var
     doc = app.activeDocument, destCell, currFile, currRec, currImage, i,
     mVarA = doc.textVariables.item("variableA"),
     mVarB = doc.textVariables.item("variableB"),
     mVarAinst = mVarA.associatedInstances,
     len = mVarAinst.length;

while (len-->0) mVarAinst[len].associatedTextVariable = mVarB;

mVarAinst is an array of instances of varA ==> no need to search through all doc

Jarek

Tags: InDesign

Similar Questions

  • Why safari does not freeze when I erase a research question and replace it with another search?

    Hello. When I search on Safari, it freezes in the following situation: I have run a search by typing in the search bar. The search results I get, it's not what I wanted, so I erase the question of search and replace it with another question of research. Instead of a new search result that Safari freezes. What is going on?

    IOS 9.2.1 does not run on iMac, as shown in your profile. If you want to help, at the very least, we need to know that the version of Mac OS X installed. If you are not sure, please click on the Apple symbol in the upper left of the screen and select about this Mac.

  • How to find all the same color in a drawing line and replace it with another color?

    Hello, I would like to replace this goat - puke green color with 'black '.

    I tried everything, but can't find the right command. I'm sure that nothing could be easier, but I'm stumped and will probably slap me in the head when I see the answer.  lol Please help.

    See you soon. -Frank

    thankyou.gif

    CTRL-SHIFT-u (windows) cmd-shift-u (mac) - desaturates

    CTRL-i (Windows) cmd - i (mac) - reverse

    CTRL-l (Windows) cmd - l (mac) - levels

    In the levels dialog box there are three triangles in the Middle window, drag the triangle to the left to the right until your text is completely black. Oh yes, it also takes your black and white background BTW the effect of the command reverse makes it.

  • How to disable apple git and replace it with another?

    Hello forum,.

    I'm new to OSX, and I need to use git. and also, due to security risks, I have to avoid to save my password for the account of git on local computer

    Of course under windows and linux, there is no problem. but under OSX, I could never imagine that it may be more difficult that way.

    the git command that provided the default is 'apple-modified version of git.

    and it STORES GIT BY DEFAULT KEYCHAIN PASSWORD WITHOUT ANY REQUEST of PERMISSION OR INTERACTION.

    I do not understand why apple did, but anyway, there at - there no guide for DISABLE the PRESENT?

    Thank you.

    Hello yujin.kwon,

    Which is not really a security risk. The keychain is encrypted. I never did, so I can't offer specific advice. All that I can do is point you to this StackOverflow question: http://stackoverflow.com/questions/16052602/disable-git-credential-osxkeychain

  • Why is it so difficult? A single click should do! I'm regretting that I signed. All I want to do is remove a sentence and replace it with something else.

    Once again! Why?

    It takes too much time. All I want to do is remove a sentence and replace it with another.

    Please see this link for a list of the forums. You can post your specific questions of the application in the forum that supports your application.

    FAQ: Where can I find creative clouds of the forums users to search or ask a question?

  • Is it possible to get a word tend to fade and then fade out and then replace it with another word that fades in and then and so on without a person having to scroll to the bottom of the page. I searched for widgets, but I have not found one that does this

    Is it possible to get a word tend to fade and then fade out and then replace it with another word that fades in and then and so on without a person having to scroll to the bottom of the page. I searched for widgets, but I have not found one that does this impeccable for a subtitle.

    You will need to do something like it in a program like Edge animate.

  • RegExp search and replace, keep the formatting of the original text

    Hello!

    Will have to perform the Search and replace within a framework of text using RegExp.

    And to retain the original formatting of the text block.

    How is it possible?

    Bad example-, it converts all the text formatting to the format of the first character:

    var reg = /a/gmi;
    var replacer = '*';
    var fr = activeDocument.textFrames[0];
    fr.contents = fr.contents.replace (reg , replacer);
    

    find_and_replace_regexp.jpg

    Thank you!

    I has not yet been tested your code.

    But why you did not play with my code snippet, use something like this:

    // regex_changeContentsOfWordOrString_RemainFormatting.jsx
    // regards pixxxel schubser
    var s = /arguments/gi;
    var replacer = "other string", result;
    var atf = activeDocument.textFrames[0];
    
    while (result = s.exec(atf.contents)) {
        try {
            aCon = atf.characters[result.index];
            aCon.length = result[0].length;
            aCon.contents = replacer;
            } catch (e) {};
        }
    

    Try it and have fun

  • How can I use search and replace to replace the title of the doc with copy of the h1 content?

    I have a site with about 300 pages which have the same title. I need to replace this title by the same text that appears in the h1 tag on the page (each page is different). Of DW search and replace it? If so, how? I don't really want to go have to go to each page and copy/paste.

    jeffsure wrote:

    Is there a way to tell him to put only the first h1 tag in the title?

    I'm really motivated now to learn regex!

    Yes. Just use the following regular expression instead of the previous:

    ([^<>[\S\s]+?

    )([^<>

    The field is to replace the same.

    The question mark is the [\S\s]+ a lazy search, stopping at the first]

    rather than doing a greedy research that concludes the last

    in the page.

    The regex for learning is difficult, but it can be very rewarding. I would only like the best.

  • Advanced search and replace. How to replace the space with carriage return?

    10.9.13.0/24, 10.9.4.2/32, 10.9.4.3/32

    in

    10.9.13.0/24
    10.9.4.2/32
    10.9.4.3/32

    Find replace them ',' with carriage return.

    I still find articles on an advanced search and replace, but I can't seem to locate it.

    OS X El Capitan 10.11.3

    3.6.1 the numbers

    HI Brendan,

    You don't need an advanced find and replace for it.

    In the search box, press, then space.

    In the box replace by, press option-return.

    Then click Find and replace and find until you are finished.

    Kind regards

    Barry

  • Search in a table by a negative number and replace it with a zero

    Hello

    I want to search in a table (dual 64 - bit) for a negative/s number and replace it with a zero.

    BR

    Probably the fastest option in this case

  • I think I bought the wrong adobe software and wants to replace it with another.  I don't see any 'central form' availability on Acrobat DC, but my colleague has on an old Pro XI Acrobat.  I would like to communicate with someone at adobe to discuss.

    I think I bought the wrong adobe software and wants to replace it with another.  I don't see any 'central form' availability on Acrobat DC, but my colleague has on an old Pro XI Acrobat.  I would like to communicate with someone at adobe to discuss. Nee

    Hi Ion,

    Forms Central is longer now.

    FormsCentral

    A trial version of forms used to be installed as part of Acrobat PRO XI Central desktop application.

    It is no longer available and is not included in Acrobat DC, however, you can always create PDF using Acrobat PRO from DC forms.

    Thank you

    Tanvi

  • Can I create a snapshot and replace it with an image (or link another picture than the current)?

    Based on http://forums.Adobe.com/thread/1308132?TSTART=0 I decided to add each question separately:

    Hello, I am very interested in buying Lightroom 5.2. I tried the RC that was missing today. Yet, I have several questions that I can't find really good conclusive answers, I'd like to get an answer before buying LR. Please do not write maybe like this or that (assumptions), because I don't want to start my entire workflow and then realize that I have to change all around, please reply, if you know for sure that something works and you are, preferably, using this method too.

    Can I create a snapshot and replace it with an image (or link another picture than the current photo)? Details: I made adjustments in iPhoto until now I want my (unpublished) masters, some RAWs JPEGs, create a snapshot and set the photo as the one to keep. If it is not possible, all of the recommendations (in addition the usual masters of backup and import changes).

    What I do is I have to assign some metadata down battery photo indicating of don't not to export the picture. Then, I use either a collection of smart to find the photo I want to and can not find the photos, I don't want and export all in the smart collection. or I use a Collection of post Smart, even once allows me to select only the pictures I want and not those I want.

    Of course you manually uncheck items you want to export, which work as well.

  • Help with GREP search and replace

    I've never used grep before and I'm stumped.  I have a document that lists the times for different classes.  Times are variously listed as 9-10, 9-10, 9-10 or 9-10, to get examples.  The problem is that there may be no space or a space on the left or the right of the hyphen.  I want it all the time as 10:30 - 11:30, for example.  In other words, the link must have a space on each side of it.  I think that this could be accomplished with GREP search and replace, but I don't understand the syntax well enough to make it work.

    Can someone tell me how to write the search and replace expressions?  (Of course the real time could be any hours).

    Thank you!

    It is tempting to add spaces of * all numbers separated by a dash. If you don't know all time have some minutes, then it is safer to use this:

    (?<=:\d\d)>

    .. Replace with space hyphen space.

    He seeks the "settler, any digit, any digit" (which is * found * not * included *), followed by 'optional of a space, a hyphen, optional space' and must be followed by 'any number' (again, not counting this one). Since the figures before and after are * found * not * included *-which is due to the (? xxx) syntax - all that needs to be replaced is the dashboard itself. Making the space before and after the optional dashboard (using a single "?" immediately after each), no matter if it * is * a space or not, all the combinations will be found and replaced.

  • What is involved in the search and replace of text

    Greetings,

    High level view of an encoder, which is involved in finding a specified text and replace it with something else?

    What are the main steps in doing this?

    Thank you for your time.

    Sincerely,

    Antoine

    Yes. Like any robust technique, the PDF specification is complicated. I'm something of a novice, but I had some success decoding PDFs. feel free to ask me any other questions.

  • I can't seem to make the "search and replace string" works as expected.

    I tried to replace "^ []] +---+ ([^] +).» "$*" with $1 in "create table leq_octave_5min (recorded_time DATETIME CONSTRAINT pk1 PRIMARY KEY, leq5m leq5m of FLOAT CONSTRAINT NOT NULL, min min FLOAT CONSTRAINT NOT NULL, max max FLOAT CONSTRAINT NOT NULL, CONSTRAINT of FLOAT L05 05 NOT NULL, CONSTRAINT of FLOAT L10 10 NOT NULL, L50 FLOAT CONSTRAINT 50 NOT NULL, L90 FLOAT 90 CONSTRAINT NOT NULL. L95 FLOTTER CONSTRAINT 95 NON NULL, us01 us01 FLOAT CONSTRAINT NOT NULL, EN02 EN02 FLOTTER CONSTRAINT NOT NULL, fr03 FR03 FLOTTER CONSTRAINT NOT NULL, fr04 FR04 FLOTTER CONSTRAINT NOT NULL, fr05 FR05 FLOTTER CONSTRAINT NOT NULL, fr06 FR06 FLOTTER CONSTRAINT NOT NULL, fr07 FR07 FLOTTER CONSTRAINT NOT NULL, fr08 FR08 FLOTTER CONSTRAINT NOT NULL, fr09 FR09 FLOTTER CONSTRAINT NOT NULL, fr10 FR10 FLOTTER CONSTRAINT NOT NULL Fr11 FR11 FLOTTER CONSTRAINT NOT NULL, FR12 FLOTTER CONSTRAINT NOT NULL fr12, fr13 FR13 FLOTTER CONSTRAINT NOT NULL, fr14 FR14 FLOTTER CONSTRAINT NOT NULL, fr15 FR15 FLOTTER CONSTRAINT NOT NULL, fr16 FR16 FLOTTER CONSTRAINT NOT NULL, fr17 FR17 FLOTTER CONSTRAINT NOT NULL, fr18 FR18 FLOTTER CONSTRAINT NOT NULL, fr19 FR19 FLOTTER CONSTRAINT NOT NULL, fr20 FR20 FLOTTER CONSTRAINT NOT NULL, fr21 FR21 FLOTTER CONSTRAINT NOT NULL Fr22 FR22 FLOTTER CONSTRAINT NOT NULL "(, e23, e23 FLOTTER CONSTRAINT NOT NULL, fr24 FR24 FLOAT CONSTRAINT NOT NULL, fr25 FR25 FLOTTER CONSTRAINT NOT NULL, fr26 FR26 FLOTTENT CONSTRAINT NOT NULL, fr27 FR27 FLOTTER CONSTRAINT NOT NULL, fr28 FR28 FLOTTER CONSTRAINT NOT NULL, fr29 FR29 FLOTTER CONSTRAINT NOT NULL, fr30 FR30 FLOTTER CONSTRAINT NOT NULL, status TEXT (2) st NOT NULL CONSTRAINT).

    The goal was to get the third token, 'leq_octave_5min '.

    The result string is "leq_octave_5min", but the real result string is the input string itself.

    What is the problem with my method?

    I'm sorry.

    I forgot to turn on 'regular expressions' in "Search and replace the String" VI.

    After having turned it on, it works as expected.

Maybe you are looking for