[CS4 JS] Search for and replace text by nothing

Hello

I have the script according to which seeks a Word and changes to an entire sentence to a paragraph style. I also want to remove the word I'm looking for. When I use changeTo = ""; It will not change because my value is nothing.

Script:

var myDoc = app.activeDocument;

replaceTxt();

function replaceTxt() {

   app.findTextPreferences = NothingEnum.nothing;

   app.changeTextPreferences = NothingEnum.nothing;

   app.findChangeTextOptions.wholeWord = false;

   app.findChangeTextOptions.caseSensitive = true;

   app.findChangeTextOptions.includeMasterPages = false;



      app.findTextPreferences.findWhat = "[Kop] ";
      
      app.changeTextPreferences.appliedParagraphStyle = myDoc.paragraphStyles.item("Kop"); 
      
      app.changeTextPreferences.changeTo = "";  // value is nothing so no changes???

      myDoc.changeText();

  

   app.findTextPreferences = NothingEnum.nothing;

   app.changeTextPreferences = NothingEnum.nothing;

}

Sjoerd

Sjoerd hoi,

That's right - the same behavior is in the interface. If you find the text and put nothing to change, the text is deleted. However, if you find the text but put only formatting in change, the formatting is applied and the text is not deleted.

To actually remove the text, you have two options. First is to clear changeTo after your myDoc.changeText (); order and launch the changeText again - that's how I would do it in the interface itself.

A little more advanced would be to use the result as changeText() table; Returns, but (1) I couldn't make it work, and (2) it is very probably the most quick to execute the command changeText twice.

Tags: InDesign

Similar Questions

  • What happened to search for and replace special characters

    I'm a recent update of FrameMaker 9 FrameMaker 11. I use several notations with nonbreaking hyphens and nonbreaking spaces. In version 9, I was able to use the hexadecimal codes in the Find/Replace dialog box and search and replace these ratings. Now in version 11, it does not find these characters. I end up getting more I want.

    For example: I want to find

    (E Vote, September 12, 2008)

    This text has a non-breaking hyphen and showing spaces are nonbreaking. When I entered the document these characters, I used the combination of keys "Esc hyphen:" for the hyphen and "Ctrl + space" for spaces.

    When I enter "(E\x15Vote\x10Sept.\x1012,\x102008)" and press the button Search, FrameMaker converts the text to "(E\+Vote\s#Sept.\s#12,\s#2008)" and refers to a "Not Found" statement. I get the error even if I copy the text and paste it into the Find/Replace dialog box. I tried with "Deal", "use wildcards" and whole-word checks both market. I can't find it.

    Honestly, I never noticed if verstion 9A made the conversion of \x15 to------+ and dialog of \x10 to \s#, in the search/replace because he always found what I was looking for.

    I hope someone can tell me how to solve this problem, because it is a feature I use all the time in FrameMaker. I use hyphens and nonbreaking spaces everywhere in my documents.

    I also reported this as a bug because that's what happens if feels like to me. I went out and updated my installation of FrameMaker, thinking that this may have been reported and already corrected.

    A sad FrameMaker user

    Chris

    I'm not sure that's what you're looking for, but you might.

    Copy your text ' E-voting, September 12, 2008'.

    Go to Find/replace

    Select text and character Formats Clipboard from the drop-down

    Click on Search.

  • How to search for and remove text in the Arial Narrow font?

    Hello

    I wonder if someone can help me with a problem.

    I have a great CS5 ID doc (Win 7) that has thousands of lines in the following format:

    Example: reach, reach to yari togemasu (togeru)

    In each line the first, or the words is in English all formatted in Arial Black. then, there is a space followed by words in a foreign language (in the Japanese case). These words are all in Arial condensed format.

    I would like to be able to delete all the words automatically formatted in Arial condensed (Japanese words).

    There should be a way to do that in FIND/REPLACE, but I don't see an option to find words in a specific font and then delete them.

    Can anyone suggest how this can be done automatically, so I can't do the manual removal?

    Thanks in advance for any help that anyone may be able to offer.

    Jane.

    What version of InDesign are you using?

    If you go to find the change

    Then let empty 'Search' and ' change to ' white

    Go to the 'FindForma' t and insert the font that you want to change

    Do not fill in 'Change of Format'

  • Search and replace text in multiple columns

    I have a document with 4 columns that repeat throughout the document in different lines. I would like to find and replace text for all 4 columns at the same time.  I tried a number of special characters between my column information but still can't seem to find the line.  I've included an example below of the appearance of my lines.  I would like to find and replace the first line and the third row.

    Header 1 Header 2 Header 3 Header 4
    onebcd
    efgh
    onebcd
    efgh

    Here is the special character combos, I tried:

    a ^ Mb ^ Mc ^ Md

    a ^? b ^ > c ^? d

    Thoughts?

    You can only select entire flood, copy it and select each time the raw and paste. There is no simple method to detect the sequence of the fields in a table.

  • Use VBA and Excel to open Dreamweaver HTML (CS5), search and replace text, save and close

    I would use VBA and Excel programmatically open numbered Dreamweaver HTML (CS5) and find and replace text in the view code in these files, save and close them.

    I have 5000 associations between find: x 0001 and replace: y0001 in an Excel sheet.

    I have written VBA but do not know how to open, close and save the code in the .html files view. Please... and thank you...

    [email protected]

    I use ASP.net for backend coding, I use PHP. If you want to stay with Microsoft technologies, and then you would like to use ASP.net. and a Microsoft server.

    When you have a Web site that contains many pages with similar content structure, the practice is to store all content and all variables in a database. It is possible to create a site that has hundreds of 'pages', with many variations in the pages, so they don't all look like clones, and yet all this might be based on a single web page. A website as Amazon.com has millions of 'pages', but may actually have only a dozen basic page structures.

    Convert what you now have a system like this would be a fair amount of work, but it's the way to go now.

  • Find and replace text with formatted text.

    I am trying to replace the text ' ^ 2 ' with '2' on photoshop by a search and replace, because there are many cases that on my image, but I can't seem to access any feature in photoshop which can do a search and replace for anything other than simple text. Is there a css solution, or a plugin that would allow me to do this? I have not sought on anything either on google search, although I will update this thread if I find something

    Google found this discussion Forums Adobe with different versions of the script.  I don't know exactly what made the script, but maybe it would work.  You probably want to make a backup of your documents before you run it:

    Find and replace text in multiple files from Photoshop?

  • Just updated to IOS 10 and replace text does not work

    Just updated to IOS 10 and replace text does not work.  For example typing in omg should show oh my God. Has anyone else got this?

    I did the old thing: Disconnect to iCloud and sign back in. Unfortunately, he did not turn. The same thing happened on my iMac when upgrading to Mac OS Sierra - I lost all my text replacement. I also did Disconnect from iCloud and inback Panel . Unfortunately, it also didn't do the trick. Anyone know how to restore the replacement text. It is not has resided in the cloud?

  • Find and replace text in hyperlinks

    I want to find and replace text inside all hyperlinks inside my documents.  What property of the hyperlink hyperlink text items is stored in?

    I know that the text that the hyperlink is applied is stored in:. source.sourceText.contents myHyp [len]

    But where is stored the hyperlink itself?

    Say that I have a bunch of hyperlinks that look like: " " https://www.website.com/subsite1/Page1.html?ID=123 "

    I want to find and replace "subsite1' with 'subsite2' in order to implement all the links" " https://www.website.com/subsite2/Page1.html?ID=123 "

    Thank in advance for any assistance.

    Hello

    change . destination.destinationURL myHyp [len]

    In your case:

    // ...............
    var
         myDest = myHyp.destination.destinationURL,
         myDest = myDest.replace("subsite1","subsite2");
    
    myHyp.destination.destinationURL = myDest;
    // ...............
    

    Jarek

  • Search Mode and Mode text on the PDF Article

    Hello

    I requeted Search Mode and Mode text on the PDF Article.

    Google text mode play Magazine about 02:50 is necessary for DPS using PDF.

    http://www.YouTube.com/watch?v=xQP6_B1YNvg

    shimoawazu.

    Hi Shimoawazu,

    Thanks for the suggestion. It's something we are considering for future releases of dps.

    Neil

  • I am a beginner using Muse. Google shows all pages menu in the search results and all texts on these pages. How to just display the home page?

    I am a beginner using Muse. Google shows all pages menu in the search results and all texts on these pages. How to just display the home page?

    Thank you. I thought I created my Muse wrong site.

  • Find and replace text in documents invisibly

    Hello

    here in this forum I found the Russ find/replace function in ExtendScript, with which you can find and replace text. The script works perfectly when the documents are opened. In the case of invisibly open documents, that the script does not work since TextSelection is obviously applied. Refer to link:

    https://forums.Adobe.com/message/4032650#4032650

    I want to find and replace text within a structure of book, it would be useful if I could do it in documents that are not visibly open (Constants.FS_MakeVisible = false). Does anyone have an approach to find and replace in documents that are not visibly open? Or can someone confirm that this is only possible with TextSelection, which means that it does not work in documents open invisible?

    Thank you very much!

    Concerning

    Apollo102

    Apollo,

    I looked into this and I was able to reproduce the problem. Unfortunately, I wasn't able to find a perfect solution. Running in the debugger, I found that the failure occurs with the Find() call. All paragraphs, the text ranges, etc. are valid... it's just that the Find() call fails to find anything.

    I found that if you turn on/off the display, all of a sudden the Find() operation works with the hidden document:

    doc. IsOnScreen = true;

    doc. IsOnScreen = false;

    I don't know if this is a practical solution and of course, you may as well open visible in the first place. Would be of no help to just disable the updates with the interface?

    App. Display = false;

    Just be sure to return true at the end of the script

    I'm sorry I couldn't find a complete solution. It might be possible to appeal to something that makes the hidden document searchable, but I did not understand it.

    Russ

  • After the update of Photoshop 2015 CC welcomes "check spelling...". "and"find and replace text... "are disabled.

    Welcomes to "check spelling...". "and"find and replace text... "are disabled after I updated to Photoshop 2015 CC.

    Does anyone have a solution?

    Thank you
    Eli

    Someone has found a work around that.

    The link below.

    But is not ideal could be useful as the current problems with the point highlight text/right click on/off "check spelling" options disabled after that update CC 2015 is ruining your workflow.

    Spellchecker not available in Photoshop CC 2015

  • How to search for a particular text values separated by commas

    Hello

    I have a table for example. TB_Fruits.
    In that I have a FruitsName (Varchar) column
    In this column I store the string of values separated by commas.
    Select FruitsName in the tb_fruits;
    Result: orange, banana, Apple

    Now the question is suppose that if I try inserting one of these fruits once again name, then it must not allow me to insert.

    Suppose that now if I try to insert ('grapes, banana')
    or
    (Apple, grape")

    the orange, banana, Apple may be in any position.

    How to check if one of these names exist already or not in the fruitsname column?
    I can't use INstr function here as or. because the position is not fixed chain even not.

    Appreciate any help.

    Hmm, OK, the BASIC_LEXER in the documentation is specified is useful to "spaces separate languages". So not really a good suggestion from my side ;-)

    Okay, so a few different choices, you can play with:

    SQL> create table tb_fruits (
      2     fruitsname  varchar2(60)
      3  )
      4  /
    
    Table created.
    
    SQL> begin
      2     insert into tb_fruits values ('BANANA,APPLE');
      3     insert into tb_fruits values ('YELLOW BANANA,ORANGE');
      4     insert into tb_fruits values ('GREEN APPLE,YELLOW ORANGE');
      5     insert into tb_fruits values ('APPLE,GREEN BANANA');
      6     commit;
      7  end;
      8  /
    
    PL/SQL procedure successfully completed.
    

    Option 1:

    Make a outdated AS operator. It just won't be fast because it's more likely will be full table scan (or scan restricted index full).

    SQL> select fruitsname
      2    from tb_fruits
      3   where ','||fruitsname||',' like '%,'||'APPLE'||',%'
      4  /
    
    FRUITSNAME
    ------------------------------------------------------------
    BANANA,APPLE
    APPLE,GREEN BANANA
    
    SQL> select fruitsname
      2    from tb_fruits
      3   where ','||fruitsname||',' like '%,'||'BANANA'||',%'
      4  /
    
    FRUITSNAME
    ------------------------------------------------------------
    BANANA,APPLE
    
    SQL> select fruitsname
      2    from tb_fruits
      3   where ','||fruitsname||',' like '%,'||'YELLOW BANANA'||',%'
      4  /
    
    FRUITSNAME
    ------------------------------------------------------------
    YELLOW BANANA,ORANGE
    

    Option 2:

    Transform your data and replace the spaces with underscores. Which may or may not be a possibility for you. If your other data contains no underscores, you might fool your user interface using a view that replaces underscores with spaces when you select and a trigger before insert that replaces spaces with underscores to insert or update. Then, you can use the TEXT index.

    SQL> create table tb_fruits2 as
      2  select replace(fruitsname,' ','_') fruitsname
      3    from tb_fruits
      4  /
    
    Table created.
    
    SQL> begin
      2     ctx_ddl.create_preference('mylex', 'BASIC_LEXER');
      3     ctx_ddl.set_attribute('mylex', 'printjoins', '_-');
      4  end;
      5  /
    
    PL/SQL procedure successfully completed.
    
    SQL> create index fruitsname_idx on tb_fruits2 (fruitsname)
      2  indextype is ctxsys.ctxcat
      3  parameters (
      4  'stoplist ctxsys.empty_stoplist
      5  LEXER mylex'
      6  )
      7  /
    
    Index created.
    
    SQL> select fruitsname
      2    from tb_fruits2
      3   where catsearch(fruitsname,replace('YELLOW BANANA',' ','_'),null) > 0
      4  /
    
    FRUITSNAME
    ------------------------------------------------------------
    YELLOW_BANANA,ORANGE
    

    (I used CTXCAT rather then CONTEXT indexes to keep simple search syntax, avoid SYNCHRONIZATION problems and others. You can use CONTEXT or CTXCAT as desired.)

    Option 3:

    Transform your data in XML format instead of values separated by commas. Then create a XMLIndex.

    SQL> create table tb_fruits3 as
      2  select xmltype(''||replace(fruitsname,',','')||'') fruitsname
      3    from tb_fruits
      4  /
    
    Table created.
    
    SQL> create index fruitsname_xmlidx on tb_fruits3 (fruitsname)
      2  indextype is xdb.xmlindex
      3  /
    
    Index created.
    
    SQL> select fruitsname
      2    from tb_fruits3
      3   where xmlexists('$f/l[w="YELLOW BANANA"]' passing fruitsname as "f")
      4  /
    
    FRUITSNAME
    --------------------------------------------------------------------------------
    YELLOW BANANAORANGE
    

    (I used just 'l' for 'list of the words' and 'w' for 'word').

    Option 4:

    Create your own [url http://docs.oracle.com/cd/E11882_01/text.112/e24436/cdatadic.htm#i1008347] USER_LEXER instead of a variant of BASIC_LEXER. This would require allows you to create your own stored procedures for the index to be used, in which case you have complete control over what you set in the form of a token.

    That's the different options I can think of right now ;-)

  • How to find and replace text in the index entries?

    Hello

    Recently, I copied a manual to create a new one for another product. After a global search and replace the product names and other texts, I needed to replace a specific word that appears in the index entries.

    I noticed the search box would allow me to search the text of the marker, but I had to replaceme the word by hand - cut and paste the new Word, click on change the marker to save it and then find the next occurrence.

    It's with frame 7.2. Does anyone know a faster way to do this?

    Yours,

    Michael F.

    =========

    Peter,

    Thanks for the lead.

    I downloaded the zip file and all it contains is a DLL file, but no instructions.

    What should I do to make it work and how do I know that it works?

    Yours,

    Michael F

    ========

  • Search for and change all the bug after his conversion to Authorware 7

    A few months ago, we went from Authorware 6.5 to Authorware 7

    I have problems with a 6.5 converted to Authorware 7.0 file. I tried to convert the file again after the first compact 6.5 file. I tried it again after the Authorware 7.02 update, but still the same problem.

    The bug affects "search".

    If I get " : " and replace everything by ": " 

    i.e. get cites two spaces OR and replace by quote single space OR

    There is no problem of search and replace in 6.5, but version 7 search text 16 characters to the right of the correct text, it is not change because it would produce a syntax error.

    Using 'Find in calculation' correctly identifies the first occurrence of

    quote two spaces OR

    Another example, if I get a variable named Mode, the first, several items are correctly identified, but ultimately it incorrectly highlights text.

    I tried in both XP & Vista, with similar results. Obviously, editing is a nightmare, because of global change, I now by clicking next several times, check that the correct text has been detected before the election change the code.

    I copied and pasted the calculation containing cites two spaces OR, a spreadsheet Excel and got the Ascii code all 9000 characters. The lowest recorded value is 32, half, I expect a non-display less than 32 character could be the cause of the error.

    Could find no mention of this error on the forum, I contacted Adobe. They kept me 15 days pending then lift the query at a higher level. For two months, they have ignored every week queries asking what was going on.

    This was their response, if any.

    Monday, November 30, 2009 1:34:07 AM PST
    Hello Tom,

    Thank you for providing your information.

    We wish to inform you that there is something on the text in the
    calculation, as saved from Authorware 6.5, which is not Authorware 7
    as. The only way I found to stop this is to cut and rebonding of
    calculation script in Authorware 7. You may need to check that
    the find command is highlighted before you apply the changes, and when he sees a
    problem like that, you have to copy / paste for this calculation. We
    were afraid of us can't see another way to stop this, and like Authorware's
    is not developed, there is no engineering team we can point to.

    For additional assistance, please contact us at the Support Web Portal:
    www.Adobe.com/support or you can use the following on support options
    the Adobe Web site:

    * The user-to-User Forums where you can enter your problem or
    desire to see if another user of Adobe can offer advice. Access to this
    resource address www.adobeforums.com.

    * The Support Knowledgebase, which contains solutions to problems

    that occur on the assumption of the operating systems (<>) and products of <>).

    Thank you Adobe chossing.

    Abhishek

    I have never been a fan of Adobe, even before they took from Macromedia and abandoned Authorware. Their terrible support strengthens my opinion of them

    I asked Adobe if it is possible to convert in 6.5 (but no answer).

    Any suggestions?

    Looks like you have found the solution that could make the search and replace works for good. "Diving code", I mentioned at the top of the queue showme is a calc that is attached to the card. Open one of the showme files and double-click the = at the top left of the map at the top of the page. You can only paste a calc icon in your file. I'm not sure that your solution works for every situation... for instance if you replace the SPACE BACK by RETURN, then he could not correct the problem, if there are lines with several spaces at the end... Here again - maybe using GetCalc and SetCalc will be Authorware re - compile the Calc and fix the problems of every search and replace.

    Mike

Maybe you are looking for