FindChangeByList scripting

Hello

How the script (line of code in notepad.txt IE grep or text) would look like the following description:

Find all the headings using the Arial font and fontsize 10.5 and replace the font Calibri and fontsize 12.

?

You'd make my day! And I would be grateful.

With regard to Camille

Hello

Try this:

grep {"findWhat:"\\u+",appliedFont:"Arial",fontSize:"10.5""} {changeTo: "', appliedFont: 'Calibri', fontSize: '12'"} {includeMasterPages:true, includeHiddenLayers:true, includeFootnotes:true, wholeWord:false} find all double spaces and replace them with single spaces.  grep {findWhat: "', appliedFont:" Arial", fontSize:"10.5"} {changeTo:" ', appliedFont: "Calibri", fontSize: '12'} {includeMasterPages:true, includeHiddenLayers:true, includeFootnotes:true, wholeWord:false} find all double spaces and replace them with single spaces.

Tags: InDesign

Similar Questions

  • FindChangeByList script question, re: when a style is part of a group of style

    Hello

    I use script FindChangeByList InDesign and run into a problem.

    Here's the line of problem:

    grep {findWhat:"^."} {appliedParagraphStyle:app.activeDocument.paragraphStyleGroups.item("Text").paragraphStyles.item("Body2.TextIndent"), changeConditionsMode:1919250519} {includeLockedStoriesForFind:false, includeLockedLayersForFind:false, includeHiddenLayers:false, includeMasterPages:false, includeFootnotes:true} //Change everything to Text.indent2 style

    What I'm trying to do, it's each paragraph in shape with the style called "Body2.TextIndent" which is in my style sheets in a group called "text".

    This line does not work for me; I get a JavaScript "Error #17.". Error string: the variable name expected. »

    Please note that I CAN get this line to work just fine if I use a style that is NOT in a group. For example, this line works very well for me:

    grep {findWhat:"^."} {appliedParagraphStyle:"Body2.TextIndent", changeConditionsMode:1919250519} {includeLockedStoriesForFind:false, includeLockedLayersForFind:false, includeHiddenLayers:false, includeMasterPages:false, includeFootnotes:true} //Change everything to Text.indent2 style

    The problem is apparently that the FindChangeByList script does not like style groups. I found it by internet Google and found this link:

    http://www.listsearch.com/InDesign/thread/index.Lasso?17986

    Can anyone help?

    Thank you.

    What version of InDesign are you using?

    The following line works for me on CS3, Mac.

    grep     {findWhat:"^."}     {appliedParagraphStyle:app.activeDocument.paragraphStyleGroups.item("Text").paragraphStyles.item("Body2.TextIndent")}     {includeLockedStoriesForFind:false, includeLockedLayersForFind:false, includeHiddenLayers:false, includeMasterPages:false, includeFootnotes:true}     //Change everything to Text.indent2 style
    

    Kasyan

  • Change the glyph with the FindChangeByList script

    Can someone write me a sampling line for change 'Glyph' with script FindChangeByList please?

    I found the solution.

    Using Javascript FindChangeByList

  • FindChangeByList Script, some GREP queries do not work

    I adjusted the queries on 'FindChangeList.txt' to my needs. There are towing GREP queries that will not work with the script but works perfectly well with the Interface of search/replace. I have no explanation for this strange behavior. Can anyone help?

    These are the two queries:

    grep {findWhat: "\A\s+"} {"changeTo: ' ' '} {includeMasterPages:true, includeHiddenLayers:true, includeFootnotes:true, wholeword:false} storystart: CONTROL all white space.

    grep {findWhat: "\s+\Z"} {"changeTo: ' ' '} {includeMasterPages:true, includeHiddenLayers:true, includeFootnotes:true, wholeword:false} storyend: CONTROL all white space.

    Thank you very much.

    grep {findWhat: "\A\s+"} {"changeTo: ' ' '} {includeMasterPages:true, includeHiddenLayers:true, includeFootnotes:true, wholeword:false}

    It is the version of JavaScript, you need to double the backslashes if string Analyzer JavaScript eat.  In other words: {findWhat: '\\A\\s+'}.

    Because this completely destroyed the readability of regexp, I would use rather {findWhat: / \A\s + / .source}

    but I understand why it is not popular.

  • Find format preferences in a script of find/change GREP?

    Hi all

    I create my first script to search/replace to run GREP queries several at once. But I am struggling to find how to specify the Format to find: preferably in the script that can be in the usual find/replace dialog box.

    Here is an example of a line in my script. What I want to achieve is for the line search for words/characters who currently have [standard paragraph] applied and then change the format of a paragraph style particular, I called "team name"...

    grep {findWhat: "(.+) ', appliedParagraphStyle: '[standard paragraph]'"} {changeTo: '$1', appliedParagraphStyle: 'The team name'} {} / / apply style name team

    BTW, I use the standard FindChangeByList script that comes with Indesign. Any help/comments are appreciated.

    See you soon,.

    Marco

    Instead of the name of the style, try the object of paragraph style:

    grep {findWhat: "(.+)", .paragraphStyles appliedParagraphStyle:app.documents [0] [1] ""} {changeTo: '$1', appliedParagraphStyle: 'new style'} {}

    Peter

  • script to run several queries to find/replace

    Working on a big book of ID document (* .indb), I saved dozens of queries to search/replace (named "col01', 'col02' etc.) that I run on 'all documents '. For some reason, I have to run these queries several times a day.

    So I'm wondering if he has, or if someone out there will write: a script that runs these queries one after another. Given the size of the book, it may be necessary to provide the script to pause after each query (before it turns on with the next), but I'm just guessing.

    Any help is very appreciated!

  • Replacement of specific links to script

    Our company is the subject of a change in name/logo and we have around indesign documents of 1000-1500, who need to have the logo replaced/re-related links.

    I need help creating a script, javascript, which will allow me to recreate a link to about 10 files of different logos to completely different paths with different file names using preferably.   All files located on a windows-based server, and are all our users indesign cs5.0 windows based as well.  I would like the script to loop through a set of links specific logo it will replace any and all instances of former logos with new logos.

    Example of

    K:\poor\directory\structure\sadface\RedCoLogo_White.EPS becomes L:\CompanyLogos\BlueIncLogo_W.eps

    K:\poor\directory\structure\sadface\RedCoLogo_Black.EPS becomes L:\CompanyLogos\BlueIncLogo_B.eps

    K:\poor\directory\structure\sadface\RedCoLogo_Red.EPS becomes L:\CompanyLogos\BlueIncLogo_R.eps

    K:\poor\directory\structure\sadface\RedCoLogo_Green.EPS becomes L:\CompanyLogos\BlueIncLogo_G.eps

    I've tried some premade scripts that use dialogs at the entrance of the old and new path, but I need the script runs without user intervention, so it can batch run by using another script that I found which will open the indesign files in a given directory, run a script, save and close.

    I do not know very well of javascript, but I'm fimiliar with its functioning and its syntax/etc; I've already customized a handful of FindChangeByList scripts to use different txt files and active loop through a number of indesign files.

    Any help would be greatly appreciated.

    Hello

    I added the adjustment options...

    #target InDesign
    
    app.scriptPreferences.userInteractionLevel = UserInteractionLevels.NEVER_INTERACT
    app.activate();
    
    var myFolder = 'L:/CompanyLogos/';
    var toSearch = ['RedCoLogo_White.eps', 'RedCoLogo_Black.eps', 'RedCoLogo_Red.eps', 'RedCoLogo_Green.eps'];
    var toRelink = ['BlueIncLogo_W.eps', 'BlueIncLogo_B.eps', 'BlueIncLogo_R.eps', 'BlueIncLogo_G.eps'];
    
    var inddFiles = Folder.selectDialog ('Please choose folder with *.indd-files').getFiles('*.indd');
    var l = inddFiles.length;
    
     if (l === 0){displayDialog('The selcted folder doesn\'t contain ID-Files'); exit()};
    
    while(l--){
        try{
    app.open(inddFiles[l]);
    var theDoc = app.activeDocument;
    
    var allLinkNames =theDoc.links.everyItem().name;
    
    for(var i = 0; i < toSearch.length; i++)
    {
    var myName = toSearch[i];
    for(var s = 0; s < allLinkNames.length; s++)
    {
    var linkName = allLinkNames[s];
    if    (linkName === myName){
    var newFile = File(myFolder + toRelink[i]);
    
    with(theDoc.links[s]){
        relink(newFile);
    parent.fit(FitOptions.fillProportionally);
    parent.fit(FitOptions.centerContent);
    }
    
            }
        }
            }
    
            theDoc.save();
    theDoc.close();
    
    }catch (e){
        app.scriptPreferences.userInteractionLevel = UserInteractionLevels.INTERACT_WITH_ALL;
        displayDialog(e);
        app.scriptPreferences.userInteractionLevel = UserInteractionLevels.NEVER_INTERACT;
        }
    }
    
    app.scriptPreferences.userInteractionLevel = UserInteractionLevels.INTERACT_WITH_ALL;
    
    function displayDialog(aString){
    var infoWindow = new Window("palette");
    infoWindow.add("statictext", undefined, aString);
    infoWindow.show();
    $.sleep(2000);
    infoWindow.close();
    }
    

    Hope this will work

  • FindChangeByList and associated text files

    I'm trying to convert from CS2 to CS5 and need to update all my text files that run with the FindChangeByList script. I did not write these files, but has been involved in the decision to use our process so that my knowledge of them is minimal. Unfortunately, no one left to my company doesn't have any knowledge of them is to me to dig and to update. I was able to determine the majority of the conversion, but am stuck on the last "column.

    An example of our existing script looks like this:

    {"findText:" "^ t"}     {changeText: "^ t"} all the
    {findText: "' ^ t ^ t '"}     {changeText: "^ t"} all the
    {"findText:" "^ p"}     {changeText: "^ p"} all the
    {findText: "' ^ t ^ p '"}     {changeText: "^ p"} all the
    {findText: "" ^ p ^ t ' "}     {changeText: "^ p"} all the
    {"RechercherTexte:" "-"}     {' changeText: "^ =" "} all the
    {"RechercherTexte:"-""}     {' changeText: "^ =" "} all the
    {findText: ' AM ^ p '}     {' changeText: ' am ^ p ""} once
    {findText: "PM ^ p '}     {changeText: ' h ^ p "" '} once
    {findText: ' AM ^ t '}     {' changeText: ' am ^ t ""} once
    {findText: "PM ^ t '}     {changeText: ' h ^ t "" "} once

    I'm converting it to this:

    text {"findWhat:" ^ t ""} {"changeTo:" "^ t"} {}

    text {findWhat: "^ t ^ t"} {changeTo: "" ^ t ""} {}

    text {"findWhat:" ^ p ""} {"changeTo:" ' ^ p '} {}

    text {findWhat: "^ t ^ p"} {changeTo: "" ^ p ""} {}

    text {findWhat: "^ p ^ t"} {changeTo: "" ^ p ""} {}

    text {"findWhat:"-""} {"changeTo: ' ^ = ' '} {}

    text {"findWhat: '-' '} {' changeTo: ' ^ = ' '} {}

    text {findWhat: ' AM ^ p "" '} {' changeTo: ' ' am ^ p '} {}

    text {findWhat: ' PM ^ p "" '} {changeTo: ' h ^ p '} {}

    text {findWhat: ' AM ^ t "" "} {" changeTo: ' ' am ^ t '} {}

    text {findWhat: ' PM ^ t "" "} {changeTo: ' h ^ t '} {}

    I know I'm supposed to enter text in the direction of caseSensitive:true, wholeWOrd:false, etc. Is there a quick way to determine if it is said once, it should be changed to say {} and if everything says to use {}, or can I go line by line to determine what should be the appropriate label?

    These are lines of the version of CS4 FindChangeByList - CS5 could have an updated version (even if the command find/replace has not changed):

    text {"findWhat: '-' '} {changeTo:" ^ = "} {includeMasterPages:true, includeHiddenLayers:true, includeFootnotes:true, wholeWord:false} search all space-dash-space and replace it with an en dash.

    grep {"findWhat:" + ""} {"changeTo: ' ' '} {includeMasterPages:true, includeHiddenLayers:true, includeFootnotes:true, wholeWord:false} find all double spaces and replace them with single spaces.

    It looks like you can change all with an advanced text editor (Textpad on the PC), TextWrangler on Mac - no TextEdit or Notepad using a couple of find/changes.
    The 'all' / 'once' stuff are more necessary because it was for change, for example, 3 spaces on 2, then 2-1, until no 2 places have been found. With GREP, you can do that, "in one go"-as in, the search for '+' - two spaces as well as a more - and replace it with a space. Even with several tabs (rating of GREP is '\t', not "^ t").
    A little more 'better' ways, use GREP:
    rather than {findText: ' AM ^ p "" '} {' changeText: ' "am ^ p"} once
    Use grep {findWhat: "AM$"} {changeTo: 'am'} {includeMasterPages:true, includeHiddenLayers:true, includeFootnotes:true, wholeWord:false}
    rather than {findText: "^ t ^ p"} {changeText: "^ p"} all the
    use grep {findWhat: "\t+$"} {"changeTo: ' '} {(.. includeFootnotes etc.) }
    Look in your CS5 FindChangeList.txt for more examples.
    Important: between 'grep' / 'text' and the following ' {' and between the two ""} ' / ' {', and after the last one, there should be a single TAB - not one or several spaces.} Seems that the script can not yet grok that, even though people have been frustrated by her to the first version.
  • FindChangeByList bug?

    Hello

    I use grep search in the FindChangeByList script and that one line doesn't seem to work for some reason any:

    grep {findWhat:"(?<=\w)[!?;»_%$¢°]"}_ _ _{changeTo_:_«_~_<$_0_»}) "}

    But if I copy paste the info in the normal Grep find / dialogue of change, it works.

    I'll try to find everything. ' % $¢ ° characters preceded by a letter or a number and add a thin space in front of him.

    {findWhat: '\s (?)} = [ ! ? ; "%$¢°])"} {changeTo: ' ~ < "}

    I use this line to change any existing space that precedes these signs and convert it to a thin space and it works.

    Any ideas? Are there differences in the way that I should type my expressions in the find/change grep vs dialog box by adding them to the FindChangeByList script? Or maybe the way I typed my expressions is not effective, I'm quite new to this!

    Thank you for your time,

    Emilie

    No (and yes), but remember it is not entered directly "in indesign. He will find himself inside a script - and the backslash is also a special character in Javascript. What you have entered is not a 'InDesign GREP expressions', but rather a string of Javascript that must be inspected and executed by one order to another program (which would be InDesign, in this case).

    If you enter a JavaScript '\t', InDesign will not see a t-shirt of backslash while executing the script, he will see a tab character. This isn't a problem if you don't have you intended to have a tab character somewhere, but it does not work with "\w", and almost any other code backslash. Thus, for a simple literal backslash in ID, enter two.

  • Scripting - adding a line to the exponent of the copyright and brand symbols

    I get a lot of text files from the writers and editors with™ and®'s. In InDesign, I add a line or two for the FindChangeByList script to automatically exposing these symbols. Can someone give me the GREP for this? If he could also find some MSDS superscript (where the author does not know how to create the™ symbol, but knows how to the Exhibitor, so they pretend) and replace them with™ s be fantastic.

    Thank you.

    Hi ejcarter9,

    You don't need a GREP search for them - a text search will work just fine. Add the following lines at the end of the definitions of the FindChangeByList.txt file (I assume you are using the version of JavaScript... right? If not, I will need to change the lines a bit):

    text {findWhat: "^ d"} {position: Position.superscript}, {includeMasterPages:true, includeHiddenLayers:true, includeFootnotes:true, wholeWord:false} find symbols (TM) brand and make them exposing.
    text {findWhat: "^ r"} {position: Position.superscript}, {includeMasterPages:true, includeHiddenLayers:true, includeFootnotes:true, wholeWord:false} find trademark (R) symbol and make them exposing.
    text {findWhat: 'TM', position: Position.superscript} {changeTo: ' ^ d ', position: Position.superscript '} {includeMasterPages:true, includeHiddenLayers:true, includeFootnotes:true, wholeWord:false} find the Exhibitor brand symbols typed as a "TM" and transform the symbols of the mark by exposing.

    You may need to add tabs between fields after you have copied these lines on this message - I'm not sure that the forum will maintain their when copy/paste.

    Always nice to hear from anyone using FindChangeByList! This is one of my favorites.

    Thank you

    OLE

  • How to fix the indices or false exhibitors, made with basic changes

    Hi all.

    There is a script on the Forum used to convert locally formatted to character styles - styles script to keep formatting local and CS4

    It's a brilliant script, but as I suddenly discovered (and would have discovered if I read the post more in detail) are that no 'rigged' sub/exhibitors created with basic travel do not work. To quote the other thread:

    The script search attributes such as 'exposing', 'index', 'small caps '. If the small capitals are rigged in the document with marquees in a smaller font, the script won't find them. If the exponent or index is rigged in the document with a smaller font size and a vertical offset, the script won't find them.

    Initially I didn't this would never be a problem... I thought "that Devil would be a hint or an exhibitor how? wouldn't they just click on the buttons on the index or superscript? » ... Unfortunately, no!

    I thought that a solution would be to do a GREP which could be added to a findchangebylist script bundled with InDesign. First thing to do would be to create a GREP to find any positive base change and change it by exposing. and a GREP for search all negative vertical offset and replace it with a clue. Sounds simple... until I tried to implement, as the dialog box will not take a + or - in itself... There must be a correct value.

    Everyone has faced this problem, and if so, what was the solution and results?

    Colin

    OK, this last forum link I referred to as she had the thing... kind of. Just had to modify the script that was used.

    The script below will find all vertical offset greater than 0 and apply a format local Exhibitor; and any reference pass less than 0 and apply a local index format.

    for (var j = app.activeDocument.stories.length - 1; j >= 0; j--) {
    myCharacters=app.activeDocument.stories[j].characters.everyItem().getElements()
    var color = myCharacters[j].fillColor.name;
    for (var h = myCharacters.length- 1; h >= 0; h--) {
      if (myCharacters[h].pageItems.length < 1){
          if (myCharacters[h].baselineShift > 0){
               myCharacters[h].baselineShift = 0;
               myCharacters[h].position=Position.SUPERSCRIPT
               }
          if (myCharacters[h].baselineShift < 0){
               myCharacters[h].baselineShift = 0;
               myCharacters[h].position=Position.SUBSCRIPT
               }
          }
       }
    }
    

    From here, the good ol 'preptext' script allows then track down the sub/supers and apply styles of character appropriate for them.

    Hope others find it useful.

    Colin

  • Page number of replaced text

    I use a customized version of the FindChangeByList Script included in inDesign. What it does currently is output in a log file with any changes made in the document and all of the changes.

    I would like to add a page number for each of the changed items, but so far have not been able to find a way that actually shows the number of the page. Is this possible?

    Thanks in advance,

    Brad

    I do not understand why you are doing the replacement the way you do, but maybe it's because the constraints that imposes the FindChangeByList script. The problem is in this line:

    var pageNum = myFindPreferences.parentTextFrames[0].parentPage.name;
    

    findPreferences is not parentTextFrames. You must use myFoundItems and collect the page numbers of each article found, something like this:

    var pageNumbers = [];
    for (var i = 0; i < myFoundItems.length; i++) {
       pageNumbers.push (myFoundItems[i].parentTextFrames[0].parentPage.name);
    }
    

    then later:

    logInfo = logInfo + "\n" + chopEndFind + " changed to -> " + chopEndChange + " on pages " + pageNumbers.join(',');
    

    Moreover, you can delete these four lines of 'cut' and change the line loginfo as follows:

    logInfo = logInfo + "\n" + app.findTextPreferences.findWhat + " changed to -> " + app.changeTextPreferences.changeTo + " on pages " + pageNumbers.join(',');
    

    Peter

  • CS6 findchangebuylist with javascript error

    Running Mac OS 10.6.8

    iMac 2.93 GHz Intel Core i7

    4 GB 1333 MHz DDR3

    InDesign CS6 8.0.1

    I created a new page with nothing on it except a text box. I imported some paragraph styles and text for a page master templatre created for a catalog that I've created. I created the new page to try to eliminate any problems that may have been cause by opending a document created in CS5.5. I use the latest version of 'recordfindchange' script for cs3 - cs5 written by Martin Fisher to export the result of my test of the findchange. Here is a picture of the findchange Choir:

    Screen shot 2013-07-26 at 10.05.22 AM.png

    I get an error in java script when I run the script copy buy, I created the "findchangebylist: javascript and txt, file by adding the _SimpleTest name to the names of files and replaceing the 116 line number in javascript with this:

    var myFindChangeFile = myFindFile("/FindChangeSupport/findChangeStrings_SimpleTest")

    Here is the error I get:

    Screen shot 2013-07-15 at 2.21.29 PM.png

    I don't know anything about javascript. so I am dead in the water. so can someone please help. Are there problems with the CS6 and the findchangebylist script? "recordfindchange" is no longer works with CS6? Could this be a problem of version of javascript (I've just updated to the latest version)?

    It seems I could have solved my own problem. through diligence, I came to the conclusion that every time you are appling a paragraph or style, you must include a characters ', changeConditionsMode:1919250519' in your grep. If you look above the "findChangeStrings_SimpleTest.txt" you want of course that this has not been added in. so you will get a javascript error. Also, there is an extra ',' (comma and space) in front of "findwhat" and "appliedParagraphStyle" I removed those just for consistency. but he appeard have no effect.

    He shhould look like this:

    {findWhat:"\\r\\r.+[:].+\\r} » {appliedParagraphStyle: '01-Header', changeConditionsMode:1919250519}

    SO in short, it looks like the 'ChangeCondidtionsMode:1919250519' is the key to eliminate the javascript error.

    I don't know why. All that I know is now it works.

    Looking at my file findchange.txt for the project, I am working on (not the one above) I also noticed that here we Eparses characters outside the "{" (in brackets). That was apparently CS6 crash indesign. Where I worked on the script has been written in CS5.5. This version must have been a little more forgiving with sloppy code. After cleaning all the random characters until no more accidents.

    I also have my version 8.0 CS6 upated version 8.0.1. Adobe has a downloadable patch. Who can help the issue as well. However, it has not helped the missing changeCondidtionsMode or sloppy code.

    The RecordFindChange script I was using does not have the "ChangeCondidtionsMode:1919250519" in the exported .txt file and it also adds additional quotes. Which must be changed by a person who knows javascript and that's not me.

    I hope this helps.

  • The use of FindChange for nets of subsection control

    Is there a way to turn ruleAbove/ruleBelow and turns off using the FindChangeByList script?

    If the active paragraph style has a defined ruleBelow, but turned off, it seems that I should be able to put on with a statement in the FindChangeList.txt file as follows:

    grep {findWhat:"(some_unique_string)"} {ruleBelow:true, changeTo: '$1'} {}

    This does not throw an error, but it does not work for me.  None of the paragraph rule properties can be applied: offset, thickness of line, etc.

    Indeed, it can be done directly with a findGrep (or findChange). Look at the dialog box in InDesign and you will see that paragraph nets are not included. Given that the JS functions find take advantage of the technology that provides the features of the interactive user research, it suffers from the same limitation.

    In a script, you can work around this problem by making the discovery (rather than a change) and then iterate over the results defining the desired paragraph NET.

    Dave

  • Remove line breaks

    Hi guys,.

    I'm not very good at using the GREP command or text to FIND. How can I delete a lot of line breaks but keep the dash?

    space1.png

    I want a paragraph on the right to resemble the one on the left. I did the research comand ^ p and then change space, but which will remove the two line breaks and paragraph eventually United as this image

    space 2.png

    Any info on that?

    Thank you!

    S

    If your goal is to remove empty paragraphs, you can use the change to find predefined query (multiple back to return only in English), or run the sample FindChangeByList script which will also fix other things as mutiple spaces. and a return from space.

Maybe you are looking for