Inconsistent behavior with find/replace Applescript

Hello

I am trying to add queries additional search/replace to the script by copying and pasting existing queries in the file FindChangeList.txt, then changing variables that are changed/wanted. I'm having mixed success though - sometimes I add a new query and it turns off one of the existing queries, other times I add a new query and it just doesn't work.

Is this something to do with the copy/paste items, or are there some rules around what order the elements must be in?

For example, it works fine:

text {find what: 'Mobile'} {change to: "M"} {include notes: true, include master pages: true include hidden layers: true, any word: false} find the Mobile and replace them with M.

Yet, just before it, does not work?

text {find what: 'Business'} {change to: 'B'} {include notes: true, include master pages: true include hidden layers: true, any word: false} find businesses and replace it with B.

We're just one copy of the other, so, what's the difference?

I love this script and the time it saves me, but more I tinker with it more, it seems inconsistent.

Any suggestion would be appreciated.

See you soon

Steve

Files in text format, you should really use TextWrangler http://www.barebones.com/products/textwrangler/

(or equivalent)...

Substances

Tags: InDesign

Similar Questions

  • Strange problem with find/replace

    I'll have a little strange problem with find/change in InDesign CS4 Mac.

    The document is a data merge.  In the worksheet, there are two fields that contain either a '@' or a '&', depending on the context.  These are just placeholders - the plan was to convert glyphs of the police 'Wingdings 2' after creating the merged document.  We do it this way because we couldn't figure out how to get the glyphs themselves in the .csv file.  Two glyphs are < FO54 > and < FO56 >.

    First I used find/replace to change all the '@' symbols to < FO54 >.  That has worked well. But then when I tried to change the symbols "&" < FO56 >, I got the < FO54 > again instead.  In fact, now I ask what glyph, I get < FO54 >.  Find/replace always normally works for normal text... it of just that he seems to have decided that if I ask a glyph, I get < FO54 >, anything.

    I tried to shut down and restart, but the bug is still there.

    Any thoughts?

    I used the tabs of glyphs in find/replace when I tested it, but what you describe seems to work as well.

  • Problem with find/replace

    Hi, I'm doing a search/replace which is the first space after the text which is tagged with a specific character, called name, style and change to an en space. Thus, for example, if I had the text:

    Cowboy buckeroo or vaquero

    Cowboy has the grade name, pigsty. applied and I would like to change space between cowboy and buckeroo an en space, but let them spaces on each side where stay as they are.

    I can't understand how someone anyone help?

    Thank you

    Looking a GREP

    To find

    (.+)

    Implement

    $1 ~ >

    Find the Format:

    Do a search for

    ~>\s

    Replace:

    ~>

  • Inconsistent behavior with Ocean Optics LabVIEW driver

    Hello

    I noticed an odd behavior when using the USB2000 Ocean Optics spectrometer. When I use the driver tools read the waveform, I get a waveform of pixels in length 2022. When I use the Ocean Optics (SprectraSuite) software I have a waveform of length 2048.

    I first noticed this problem when I was looking at the spectrum of a light source that is known to be ~ 870nm. Using the LabVIEW driver, I saw a peak at ~ 857nm, but using the Ocean Optics software, I saw a pic to 870nm as expected. Please let me know if you can give no indication to this problem. Thank you

    Gregory

    Just to be tied it on, I don't end up the front of the table of the spectrum with zeros to fill. It's certainly something that would deal with Ocean Optics (or the writer of the drivers). I do not change the driver because he could shoot me in the foot when you use one of the other patterns.

    Also, I noticed that for the USB2000 Set integration time VI, the time units are milliseconds. The USB4000 (and what is suggested by the drivers/examples) use the microseconds.

    Hope that these drivers can get an update soon!

  • Find/replace on the long list of addresses

    I hope someone can help here.  I have format it more 11 000 address for publication in the following ways:

    < < current format > >

    1803156, I MEAN FIRST OF ALL, ADDRESS 1, STE 1

    1803157, I MEAN FIRST OF ALL, ADDRESS 1, STE 1

    etc...

    < < need to replace the first comma and space with a tab > >

    1803156 LAST, FIRST, ADDRESS 1, STE 1

    1803157 LAST, FIRST, ADDRESS 1, STE 1

    etc...

    Can anyone think of an easy way to do this with find/replace or another method?

    Search: (?-s)^.+?\K,\h)

    Replace by: \t

  • Why I can't get a hit with the find/replace glyphs palette. Faces of fonts checked.

    Screenshot 2015-11-04 00.30.31.png

    I received a copy (word doc) with a table using glyphs Sq Root in place and place check marks. Looking to find replace but GREP and text can't seem to manage the ROOT SQUARE or check MARK glyphs. If the glyphs tab of course right?

    Providing I still exact characters corresponding and no delicate Adobe fonts not anchored object with font substitution, that I can't seem to make a match with the glyph of the SQUARE ROOT.

    No idea why? Attack from a previous thread on my confusion even find these glyphs of fonts that appear to contain them who do not.

    Hey thanks for this tip, I've seen this kind of keyboard shortcuts commands, but never thought to use it in this situation. It turns out that, because the glyph is in a table , I need to set the "Include locked layers and locked objects (FindOnly)" even if the layer is not locked, I suppose that the tables are "locked" per class.

  • Find/replace style cell with GREP

    Hi all, (my first post here)

    I found a script very useful on this forum to find/replace cell styles in an array. I adapted the script using Peter Kahrel ebook for use with a GREP query.

    I've linked to a spreadsheet in InDesign CC 2014 I want to highlight the cell of new products that contain the value [Y].

    When I run the script below, I get random results.

    myDoc = app.activeDocument var

    app.findGrepPreferences = app.changeGrepPreferences = null

    app.findGrepPreferences.findWhat = "\[\u\"]

    var myFound = myDoc.findGrep)

    for (i = 0; i < myFound.length; i ++)

    {

    If (. parent.constructor.name myFound [i] == "Cell")

    {

    . parent.appliedCellStyle myFound [i] = "New_Product_Cell".

    }

    }

    Modify the script that I wrote above.

    Otherwise your discovery is just '[u]' ==> multi-ad found is--> Direct manufacturer name


    Jarek

  • Find/replace help with generic numbers...

    Hello... I am looking for help with wildcards.

    I have a specific task to complete... I have to add dash & space in a space in a string of letters and characters...

    here

    221 Kbps - 00:28:34space dash space here47 MB - 44.1 kHz

    198 kbps - 01:27:43 41 MB - 44.1 kHz

    215 Kbps - 00:34:52 156 MB - 44.1 kHz

    225-14 Kbps: 32:00 54 Mb - 48 kHz

    If my finished text will look like this

    221 Kbps - 00:28:34 47Mb - 44.1 kHz

    198 kbps - 01:27:43 - 41 Mb - 44.1 kHz

    215 Kbps - 00:34:52 -156 MB - 44.1 kHz

    225-14 Kbps: 32:00 - 54 Mb - 48 kHz

    There are many variables the text - but I thought that maybe I could create a generic figure find/replace, based on the Mb of type bit, replacing the single space space hyphen space

    BUT

    I need to keep the numbers before the MB

    so my question - is it possible to KEEP the NUMBERS of GENERIC character?

    Thank you very much!

    If text is like that throughout, you could do a search for

    To find

    (\:\d\d)\s+(\d+Mb)

    Implement

    $1-$2

    Try it on a few see if it works.

  • Need help with this find/replace Script.

    Hi I got this script from Loic.Aigon.  And I got it works for find/replace simple changes however I Cannon operate for several changes.

     function cb5CallBack(target) {
            var findProps, changeProps;
            
                findProps = {findWhat:"Distributed by ",}   
                  changeProps = { changeTo:"Distributed by. ",}
                findProps = {findWhat:"Distribué par ",}   
                  changeProps = { changeTo:"Distribué par. ",}
                findProps = {findWhat:"Distribuido por ",}    
                  changeProps = { changeTo:"Distribuido por. ",},
              
            RTXT(target, findProps, changeProps);   
            } 
    

    function RTXT(target, findProps, changeProps)
    {
    app.findChangeTextOptions.caseSensitive = true;
    app.findTextPreferences = app.changeTextPreferences = NothingEnum.nothing;
    app.findTextPreferences.properties = findProps;
    app.changeTextPreferences.properties = changeProps;
    app.changeTextPreferences.properties = changeProps;
    target.changeText();
    }
    

    You must call the function RTXT repeatedly as well:

        var findProps, changeProps;

        findProps   = { findWhat:"Distributed by "};

        changeProps = { changeTo:"Distributed by. "};

        RTXT(target, findProps, changeProps);

        findProps   = { findWhat:"Distribué par "};

        changeProps = { changeTo:"Distribué par. "};

        RTXT(target, findProps, changeProps);

        findProps   = { findWhat:"Distribuido por "};

        changeProps = { changeTo:"Distribuido por. "};

        RTXT(target, findProps, changeProps);

  • Find/replace a Word and a space with an em dash

    I imported the text in there: "title:" (note the space after the colon)

    I wanted to replace the word, colon and space by an em dash.

    But InDesign is not letting me do. I can find/replace "title:" without the space. But I want to replace this space, too! How can I do this? Thank you!

    Julie

    Hello

    ? Why not just replace the word, colon and space by an em dash?

    Grep search:

    Search: Title: \s*

    Replace by: ~ _

  • Help with wildcards and find/replace

    I have indesign CS5 and I'm working on a document that contains a number of mathematical examples throughout these 9-1 = 8. The corrector said must change to be a space between each symbol figure and math at 9-1 = 8. How can I do this? When I go to find/replace, I have the option of wildcards in find, but not to replace it.

    The dashboard in these equations must also be changed to quadratins. How can I know indesign is any time sees such an equation, the dashboard must be changed? I don't want to just change all the dashes as I much dashes that need to stay.

    Try it on greep

    Search: (\d+)\-(\d+)\=(\d+)

    Change: $1 / $2 = $3

  • Find/replace with notes

    Hi all. I'm in CS3 and trying to use find/replace to put periods after the reference numbers and keep the tab after the numbers in place. However, I can FIND the reference number and the tab, but I can't find/replace to add a delay between the two without obliterating the reference number. Any help? I'm going slightly mental.

    Hello

    Why not add a period of Separator in the note Options dialog box?

    Type > Options Document reference > numbering and formatting tab > separator

  • Help with letters in find/replace

    Hiyis. I am trying to replace all instances of 'US' 'US', but when I type in find/replace, I get stuff like 'chat' highlighted. No way to specify simply WE capitalized on its own? Or do I have to go through and review each proposed amendment?

    Thanks tons!

    Click on the icons for the case-sensitive and whole word in the dialog box:

  • Problem with find/change GREP

    Hi, try to run by default find/replace InDesign AppleScript script to solve many formatting problems in a large document. One of them is occurences of a two-digit dollar figure followed by a comma (eg. "$ 10") that needs to be changed to have no comma.

    Use GREP I can pick it up by searching for "\$\d\d", but when I replace it with '\$\d\d' I get the string "\$\d\d". IE. "$ 10" becomes "\$\d\d" instead of "$ 10." I'm misunderstanding how works the part 'change' grep? Can someone advise?

    FYI the line in the search/replace support .txt doc is:

    grep{find what: "-\\d\\d$,"}{change to: "\\$\\d\\d"}{include notes: true, include master pages: true include hidden layers: true, any word: false}Remove commas after the price.

    .. What includes the extra backslashes to escape the backslash which are part of the GREP expression.

    Any help much appreciated!

    Thank you.

    On Grep Pallette, use below syntax to find two or more digit dollar figure followed by a text of commas,

    Search: (\$\d+),

    Change of: $1

    Vandy

  • Scripting VI: inconsistent behavior of terms [] of a wire / owner

    Suppose I have the following vi:

    I am looking for the wire and acquire the terminals of this thread.

    The result I get is twice a terminal and once a terminal control (for indicator).

    Like this:

    So, the typical process to get the wire to the node is using the function of owner.

    It works with ordinary terminals, you get just the node-prefer (as a general-reference) - according to this:

    http://zone.NI.com/reference/en-XX/help/371361K-01/lvhowto/scripting_nav_wire_to_node/

    However, for the ControlTerminal, you get the diagram/TopLevelDiagram or anything that will place you put in this indicator.

    I consider this inconsistent behavior (even if it is easy to get around... it's a simple case-structure).

    What is the logic behind this?

    In fact, what exactly is the difference between a ControlTerminal and control? Has it something to do with the fact that I must always catalogued my knots when I browse a tree like this?

    Elements that inherit from the class of 'Control' are objects of façade. The 'ControlTerminal' class represents the terminals for these controls on the diagram.

    The extent of why end-nodes is the property of nodes and ControlTerminals are the property of diagrams, it's just the way it is.

Maybe you are looking for