my search / replace dialog

Hi all

I am writing a script which can be user to allow to search, delete and ignore the dialog box.

See my JS code below it works but I can't get alert dialog.

Could someone help me please this. Is it posible that it functions as a find & Replace dialog box.

Please cooperate me.

Thank you

Kerosk

myDialog = new window ('dialogue', "MyFindDialog");
myDialog.myFnBtn = myDialog.add ("button", undefined, "Find Next");
myDialog.myFnBtn.onClick = function()
{
myDialog.close (0);
}
myDialog.myRmBtn = myDialog.add ("button", undefined, "Delete");
myDialog.myRmBtn.onClick = function()
{
myDialog.close (1);
}
myDialog.mySkBtn = myDialog.add ("button", undefined, "Skip");
myDialog.mySkBtn.onClick = function()
{
myDialog.close (2);
}
myDialog.center ();
var myDlg = myDialog.show ();
if(myDlg == 0)
{
EmptyTf = app.activeDocument.layers.item (0) .textFrames;

for (etf = 0; etf < EmptyTf.length; etf ++)

If (EmptyTf [etf] .silence < = 0)

{

App.Select (EmptyTf [ETF]);

Alert ("selected is EMPTY Textframe.\r"+"selected Textframe" + [etf] + ' ". '");
}
}

Another yew (myDlg == 1)
{
EmptyTf = app.activeDocument.layers.item (0) .textFrames;

for (etf = 0; etf < EmptyTf.length; etf ++)

If (EmptyTf [etf] .silence < = 0)

{

App.Select (EmptyTf [ETF]);

var select = app.selection [etf];

SELECT. Remove();

Alert ("selected is EMPTY Textframe.\r"+"delete" + [etf] + ' ". '");

}
}

Another yew (myDlg == 2)
{
EmptyTf = app.activeDocument.layers.item (0) .textFrames;

for (etf = 0; etf < EmptyTf.length; etf ++)

If (EmptyTf [etf] .silence < = 0)

{

App.Select (EmptyTf [ETF]);

var select = app.selection [0];

var select = app.selection [etf + 1];

Alert ("Next" + [etf] + "". "");

}
}

Ok. So I think this will do what you want. A couple of things to note:

It will search through each TextFrame in the document. Your script only looked through the first layer. A reason for this?

#targetengine "session"

function showDialog(){
     app.selection = NothingEnum.NOTHING;
     var myTextFrames;
     var foundIndex = 0;
     var findNext = function(){
          myTextFrames = app.activeDocument.textFrames;
          for (etf=foundIndex; etf 
         

Tags: InDesign

Similar Questions

  • GREP with the Javascript vs find/replace dialog box

    InDesign CS4

    Search/replace, GREP tab dialog box

    To find:

    (www: http\:-/-/) ([\w\-\?\=\&]+[\.\/]?) +

    This expression finds links pretty well.

    When I put in a .jsx file and fire in the actions palette, it does not work.

    The following works, but obviously does not correspond to as many hypertext links:

    http\:\/\/([\w\-\]+[\.\/]?) +

    as in

    ([app.findGrepPreferences.findWhat = ' http\:\/\/([\w\-\]+[\.\/]?) +';

    I tried to add?,-?, and? but it bombards the - no match.

    Same with initial either / or between http as the beginning of the pattern and www.

    I wonder if a grep javascript guru could give me a clue as to how to translate it?

    Thank you.

    Hey!

    Definition of GREP via JavaScript needs to use to escape. If your GREP in JS expression would look like this:

    app.findGrepPreferences.findWhat = "(www|http\\:\\/\\/)([\\w\\-\\?\\=\\&]+[\\.\/]?)+";
    

    Hope that helps.

    --

    tomaxxi

    http://indisnip.WordPress.com/

  • Dreamweaver search / replacement of marked text no longer work

    Dreamweaver search / replacement of marked text no longer work

    When I mark a block of text and begin to replace a single string for example, DW replace only the first is the string a judgment of exploitation

    Try to update your version of DW Adobe - Dreamweaver Support Center: Updaters

  • Search &amp; replace history in illustrator

    How to maintain search & replace history, when I quit illustrator and open search & replace history disappears

    Screen Shot 2016-05-20 at 2.33.43 PM.pngScreen Shot 2016-05-20 at 2.33.54 PM.png

    @

    But you could add 'save queries to search/replace' in the feature request form, and maybe we'll get it in a future version. Feature request/Bug Report Form

  • How the process of searching / replacing text within brackets ([])

    Hello

    How the process of searching / replacing text within brackets ([]).

    I want to make the process so that the replacement inside text: ([]) this particular color and style of a particular paragraph.

    You try this option: (-[]) ([*. * \w*\d*)(\])

    Unfortunately, the process was not successfully that entirely, it does not determine if there is more than one paragraph.

    File test installation with photos.

    Sorry for mistakes in writing, I don't know English well.

    PDF + INDD

    http://www.up-00.com/?ggcf

    http://www.up-00.com/?QBcf


    Fonts:

    http://www.up-00.com/?ABcf

    Test_3.png

    Test_2.png

    Test_1.png

    Relevant if no Notes: (?s)\[.+?\]

    If not, this regular expression could play the game:   (?s)\[(~F?. *?) +\]

  • Questions of character Tag search/replace

    FM 12.0.4.445 on Windows 7 Enterprise

    I created a character tag (Skip spelling) with all the properties defined on "such what" with the exception of the language, which is set to 'None '. The purpose of this tag must be FM to skip some words for spell checking. For example, my paper discusses many different file extensions, such as. TXT. DAT, etc. These terms may not be added to the dictionary due to the parameter 'space before' for periods, I don't want to change.

    By applying this tag character works fine, except in two cases:

    • All first, apply occasionally forces an end to the next line of a paragraph, as if the term has increased in size. Not a big deal, but I'm curious as to why this would happen. It also makes me wonder about the spread and stretch the parameters remaining at 0% and 100%, well I tried to delete the definition of character tag.
    • More important still, using find/replace with change = by gluing applies the new tag of character but also changes "BOLD" to plain text, especially in the "BOLD" headings. (Copy special > character Format has been used to copy the character tag.) Apply the tag of character directly for a term of "BOLD" does not remove the "BOLD". Is the find/replace properly configured or it is a bug?

    Thanks a lot for your help.

    I can't help much with respacing number. Check that your character Skip spelling format is really changing only the language. See what changes in the Character Designer when you apply the format, or save a MIF file and review the definition of your character Skip spelling format.

    Copy special > copy character Format all the properties of the formatting of characters. If the Find/Replace dialog box behaves as expected - which unfortunately for you, is not as intended.

  • How rename (search/replace) par UN script styles sheets

    How rename (search/replace) the sheets of styles, par UN script?

    In order to remove all the "exotic" characters

    I think you chose the wrong forum. This forum, EST pour Acrobat JavaScript only.

  • Search &amp; replace confirmation

    I installed SQL Developer 4.0.0.13 and I'm not really fond of the new confirmation box search / replace.  Around the screen, it jumps to the next occurrence of the text being constantly have to hunt the box around the confirmation screen.  I'd rather have the features like pre - 4.0 versions that keep the box of confirmation in one place while stressing again the next shot.

    Is - this configurable?  I don't see this in the preferences.

    Thank you.

    No hunting around not required, just use the shortcut keys Alt + Y, Alt + N, Alt + A

  • How can I make a long list of search - replace only the master

    Hello world

    I had this script:

    //---------------------------------------------------------------------------------------- -------------------------------

    myDocuments var = app.documents.everyItem ();
    var myLayers = myDocuments.layers.everyItem ();

    Locked text on master blocks spreads are not affected.
    If you want to unblock, please add something like this:

    Unlock all elements of each document page on is spreading and Captain spreads (optional):
    myDocuments.pageItems.everyItem (.locked = false);

    var myPageItemsOnNormalSpreads = myDocuments.spreads.everyItem ().pageItems.everyItem ();

    Unlock the layers (optional)
    myLayers.locked = false;

    Lock all elements of page level first on normal spreads
    This leaves the elements on the page on unlocked master spreads:
    myPageItemsOnNormalSpreads.locked = true;

    Now for the GREP part:
    app.findChangeGrepOptions.includeMasterPages = true;
    app.findGrepPreferences = changeGrepPreferences = null;
    app.findGrepPreferences.findWhat = "\\b20\\d+\\b";

    Research on "all open document" level
    Which returns an array of arrays:
    var myTarget = myDocuments.findGrep ();

    Flattening of myTarget Bay:
    var flattenedFoundArray = [];

    for (var n = 0; n < myTarget.length; n ++) {}
    flattenedFoundArray = flattenedFoundArray.concat (myTarget [n]);
    };

    Change the content of the texts found in flat table:
    for (var n = flattenedFoundArray.length - 1; n > = 0; n-) {}
    flattenedFoundArray [n] .silence = String (Number(flattenedFoundArray[n].contents) + 1);
    };

    Unlock all objects on normal spreads:
    myPageItemsOnNormalSpreads.locked = false;

    Reset search GREP and edit the prefs:
    app.findGrepPreferences = changeGrepPreferences = null;

    //---------------------------------------------------------------------------------------- -------------------------------

    made by Uwe

    I change in this, to make a multi elements of search - replace only the master

    //==============================================================================

    myDocuments var = app.documents.everyItem ();
    var myLayers = myDocuments.layers.everyItem ();

    Locked text spreads masters frameworks are not affected.
    If you want to unblock, please add something like this:

    Unlock all items page of each document of spreads and master spreads (optional):
    myDocuments.pageItems.everyItem (.locked = false);

    var myPageItemsOnNormalSpreads = myDocuments.spreads.everyItem ().pageItems.everyItem ();

    Unlock the layers (optional)
    myLayers.locked = false;

    Lock all elements of page level first on normal spreads
    This leaves the elements on the page on unlocked master spreads:
    myPageItemsOnNormalSpreads.locked = true;

    Now for the GREP part:
    app.findChangeGrepOptions.includeMasterPages = true;
    app.findGrepPreferences = changeGrepPreferences = null;
    app.findGrepPreferences.findWhat = "USA";

    Research on "all open document" level
    Which returns an array of arrays:
    var myTarget = myDocuments.findGrep ();

    Flattening of myTarget Bay:
    var flattenedFoundArray = [];

    for (var n = 0; n < myTarget.length; n ++) {}
    flattenedFoundArray = flattenedFoundArray.concat (myTarget [n]);
    };

    Change the content of the texts found in flat table:
    for (var n = flattenedFoundArray.length - 1; n > = 0; n-) {}
    flattenedFoundArray [n] .silence = "CHINA";
    };

    Unlock all objects on normal spreads:
    myPageItemsOnNormalSpreads.locked = false;

    Reset search GREP and edit the prefs:
    app.findGrepPreferences = changeGrepPreferences = null;


    //---------------------------------------------------------------------------------------- -------------------------------

    myDocuments var = app.documents.everyItem ();
    var myLayers = myDocuments.layers.everyItem ();

    Locked text spreads masters frameworks are not affected.
    If you want to unblock, please add something like this:

    Unlock all items page of each document of spreads and master spreads (optional):
    myDocuments.pageItems.everyItem (.locked = false);

    var myPageItemsOnNormalSpreads = myDocuments.spreads.everyItem ().pageItems.everyItem ();

    Unlock the layers (optional)
    myLayers.locked = false;

    Lock all elements of page level first on normal spreads
    This leaves the elements on the page on unlocked master spreads:
    myPageItemsOnNormalSpreads.locked = true;

    Now for the GREP part:
    app.findChangeGrepOptions.includeMasterPages = true;
    app.findGrepPreferences = changeGrepPreferences = null;
    app.findGrepPreferences.findWhat = 'Washington DC';

    Research on "all open document" level
    Which returns an array of arrays:
    var myTarget = myDocuments.findGrep ();

    Flattening of myTarget Bay:
    var flattenedFoundArray = [];

    for (var n = 0; n < myTarget.length; n ++) {}
    flattenedFoundArray = flattenedFoundArray.concat (myTarget [n]);
    };

    Change the content of the texts found in flat table:
    for (var n = flattenedFoundArray.length - 1; n > = 0; n-) {}
    flattenedFoundArray [n] .silence = "Beijing."
    };

    Unlock all objects on normal spreads:
    myPageItemsOnNormalSpreads.locked = false;

    Reset search GREP and edit the prefs:
    app.findGrepPreferences = changeGrepPreferences = null;


    //===============================================================================

    only what I can do is to repeat and repeat again

    is this another perfect solution to do?

    Thank you

    Teetan

    Try this,

    findChange("USA", "CHINA");
    findChange("Washington DC", "Beijing");
    
    function findChange (findWhat, changeContent){
        var myDocuments = app.documents.everyItem();
        var myLayers = myDocuments.layers.everyItem();
        //Locked text frames on master spreads are not touched.
        //If you want to unlock them you have to add something like this:
        //Unlock ALL page items in every document on spreads and master spreads (optional):
        myDocuments.pageItems.everyItem().locked = false;
        var myPageItemsOnNormalSpreads = myDocuments.spreads.everyItem().pageItems.everyItem();
        //Unlock the layers (optional)
        myLayers.locked = false;
        //Lock all first level page items on normal spreads
        //That leaves the page items on master spreads unlocked:
        myPageItemsOnNormalSpreads.locked = true;
        //Now for the GREP part:
        app.findChangeGrepOptions.includeMasterPages = true;
        app.findGrepPreferences = changeGrepPreferences = null;
        if(findWhat)app.findGrepPreferences.findWhat = findWhat;
        //Do the search on "all open document" level
        //That will return an array of arrays:
        var myTarget = myDocuments.findGrep();
        //Flattening the myTarget array:
        var flattenedFoundArray = [];
        for(var n=0;n=0;n--){
            if(changeContent)flattenedFoundArray[n].contents = changeContent;
            };
        //Unlock all objects on normal spreads:
        myPageItemsOnNormalSpreads.locked = false;
        //Reset GREP find and change prefs:
        app.findGrepPreferences = changeGrepPreferences = null;
    }
    

    Vandy

  • How can I search - replace in master pages only?

    Hello world

    How can I search - replace in master pages only?

    for example:

    I want to change in 2013-2014, but only in master pages.

    in master pages for all of the open files.

    How can I do?

    Teetan

    Hi Teetan,

    To set a goal is more of halfway to creation script.

    Check this box:

    app.doScript('main()', ScriptLanguage.JAVASCRIPT, undefined, UndoModes.FAST_ENTIRE_SCRIPT, "grow numbers on masters");
    function main() {
      catchOption = app.findChangeGrepOptions.includeMasterPages;
      app.findChangeGrepOptions.includeMasterPages = true;
      app.findGrepPreferences = changeGrepPreferences = null;
      app.findGrepPreferences.findWhat = "\\b\\d+\\b";
    
    var
      mTarget = app.documents.everyItem().masterSpreads.everyItem().textFrames.everyItem(),
      mFound = mTarget.findGrep(),
      mConFound = [],
      len = mFound.length;
    
      if (len && mFound[0].constructor.name == "Array")
           while (len-->0)
                mConFound = mConFound.concat(mFound[len]);
    
      len = mConFound.length;
      while (len-->0) {
           mConFound[len].contents = String(Number(mConFound[len].contents) + 1);
      }
      app.findChangeGrepOptions.includeMasterPages = catchOption;
    }
    

    Jarek

  • Script a search/replace using a data source

    So I wrote a program (c#) a few years ago which basically opens a file, InDesign Exchange, doing a search/replace, based on a datasourse SQL table and then our graphics people would just convert the INX file in InDesign and ultimately in PDF format.  Too many steps.

    There are more than 2,500 pieces of variable data in each file, so a product like DesignMerge is not practical.  Our database consists mainly of 2 fields [LookFor] and [ReplaceWith], I would like an Indesign script that will just run through the data file and do a find/replace for each record.  Is this feasible and what someone has suggestions or starting points?

    Thank you!

    No, it doesn't matter what format to use: text delimited csv or tab. Of course you can leave it as it is.

  • Application updates in bold and in italics while doing a search/replace on the contents of merged data

    Hello
    Wonder kind knowledgeable people if you can help me with a question find/replace.

    I'm doing a fusion of data of book content in indesign, where my data merge file is a simple text csv file that is delimited by tabs. I have two things (almost like here) I would like to make to specific parts of the text, but do not know how to achieve this.

    -First of all, I would like to preserve the words/phrases of form 'italic', but it's obviously lost in a csv file.  Is there anyway that I can mark these words so a search/replace can make this italic of the word.  Im hoping that there is a solution that looks something like this;
    for example.  Content of the book is 'the italics of the word needs to be adjusted.
    Original content is modified to be "the word $Italic $ $ needs to be adjusted", so that a dollar sign encapsulates the word in italics.
    Then I am able to merge data from the csv file and somehow make a search/replace words/phrases that are wrapped by the dollar sign.  So, do a find/replace all the words/phrases that satisfy this condition and then apply italic to all the words between the dollar signs.

    -My other question is that I use the ' |' character in my text to determine paragraph separators.  I then do a find/replace after you import the text to replace all occurrences of ' |' for the paragraph separator (a kind of symbol $, a representative character in the menu drop down to the right of the change to). It works fine, but I would like to make a "BOLD" format paragraph separator so that it can better distinguish the separation of text sections.

    But this is different from my problem "italic" above, since I am trying to apply a "BOLD" format to the character "change to", rather than something that exists in my original csv.

    Hope I think, but I'd be happy to provide you with screenshots etc. (when I get home at )
    Best Rgds
    L

    two solutions.

    for the solution of italics, I would say that the OP has answered his own question with one exception - do not use the symbols dollar, instead use = or another character that is not reserved by GREP.

    the solution I would use for italics would be a GREP search once the merger completed. Take a look at the picture to see what I did.

    the second solution: styles GREP.

    This means that the text will have a paragraph style are entrusted to him. make a style and character called "BOLD" in this style, the only thing to change is located in basic character formats, set the bold font style. might even make the character another example cyan color is more easily strucure.

    Then go to the paragraph style options, click on GREP styles and correspond to the following screengrab

    the advantage with a GREP style is that once the vertical bar (|) is replaced, the GREP style bold is lost; and that means less post processing and not needing a second search of the text - it's all living.

  • allows you to search/replace to delete certain hidden character

    Hallo, I imported a text file from a CSV using the data merge, now inside indesign text, I find some hidden character as two points (see the screenshot in attachment), what is the code to use in the window search/replace to select and remove all the? I have two years ago but don't remember how.

    Maybe "" in find it field can work (by replacing with nothing). Try first if ID is really something!

  • Do case-insensitive search/replace

    I use the basic find/replace script that comes with CS4

    How can I fix these sort the returned "yd³" does not like Yd³?  I want to do these search/replace case.  Bottom of case 'in' tiny 'out '.   Top of case 'IN' uppercase 'OUT '.

    "text {findWhat:"cu.yd.} ". {changeTo: "yd³"} {includeMasterPages:true, includeHiddenLayers:true, includeFootnotes:true, wholeWord:false} Find out all the dashboard dashboard and replace it with an em dash.
    text {findWhat: "cu.yd"} {changeTo: 'yd³'} {includeMasterPages:true, includeHiddenLayers:true, includeFootnotes:true, wholeWord:false} find all the dashboard dashboard and replace it with an em dash.
    text {findWhat: "vg3"} {changeTo: 'yd³'} {includeMasterPages:true, includeHiddenLayers:true, includeFootnotes:true, wholeWord:false} find all the dashboard dashboard and replace it with an em dash.
    text {findWhat: "cu.yd"} {changeTo: 'yd³'} {includeMasterPages:true, includeHiddenLayers:true, includeFootnotes:true, wholeWord:false} find all the dashboard dashboard and replace it with an em dash.

    Thank you in advance.

    Bill Bernhardt

    Publications of DOOSAN

    770-831-2249.

    Add caseSensitive:true to the list of options.

    Peter

  • Search &amp; replace - can search a nonstandard file extensions?

    I m need to use find / replace to search for text in files with the extension *.ini, but don t DW (CS4) 'open to search for' this type of file, even I select the file and use "selected files to the Site."

    There is a trick to do this?

    TKS

    Baraldi

    I have not tested with search & replace, but instructions on how to get Dreamweaver to recognize other file name extensions can be found here:

    http://go.adobe.com/kb/ts_tn_16410_en-us.

Maybe you are looking for