How to highlight continue 3 Word of hyphen-nit end line

Dear friends,

I need your help!

How to highlight the word continue 3 line end hyphen-nit? Screenshot below.

Screen+Shot+2016-02-12+at+11.22.00+PM.png

I did highlight for all the word of hyphen-nit (here is my code). But I need to highlight to continue 3 line hyphen-nit words only. Otherwise no. need simple and double highlighted of hyphenated words. Please suggest friends

My code:

var doc = app.activeDocument,    
    _stories = doc.stories;    
for(var i=0;i<_stories.length;i++)    
{    
        var _lines = _stories[i].lines;    
        for(var j=0;j<_lines.length;j++)    
        {    
                if(_lines[j].words[-1].lines.length >= 2)  
                {  
                        _lines[j].words[-1].fillColor = "Green";  
                    }  
            }    
    } 

Thanks in advance

Hi Marlon

If you are looking to highlight all occurrences of last words of 3 or more consecutive, you can try.

I do not pretend that it is a particularly effective way to do it.

function color3PlusHyphenateted() {
    var doc, stories, n, l, lastWords, firstWords, hyphenateted, e, i, lwl, HReg;
    HReg = /HHH+/g;
    doc = app.activeDocument;
    stories = doc.stories.everyItem().getElements().slice(0);
    l = stories.length;
    for (n = 0; n < l; n++) {
        lastWords = [0].concat([], stories[n].lines.everyItem().words[-1].getElements().slice(0));
        firstWords = stories[n].lines.everyItem().words[0].getElements().slice(0);
        lwl = lastWords.length;
        hyphenateted = [];
        for (i = 1; i < lwl; i++) {
            hyphenateted[i] = (lastWords[i] === firstWords[i]) ? 'H' : '0';
        }

        hyphenateted = hyphenateted.join('');
        while (e = HReg.exec(hyphenateted)) {
            for (i = e.index + 1; i <= HReg.lastIndex; i++) {
                lastWords[i].fillColor = doc.colors[3];
            }
        }
        HReg.lastIndex = 0;
    }
}
app.doScript(color3PlusHyphenateted,ScriptLanguage.JAVASCRIPT,undefined, UndoModes.ENTIRE_SCRIPT, 'color3PlusHyphenateted');

If you select only all occurrences of exactly 3 consecutive words in last hyphen, change the line

HReg = /HHH+/g;

TO

HReg = /HHH/g;

HTH

Trevor

Tags: InDesign

Similar Questions

  • When I open a PDF and try and connect you to convert the document to word format he said "reader has no ability to access this service" and it doesn't let me move forward. What this means and how do I continue to Word so I can edit pdf

    When I open a PDF and try and connect you to convert the document to word format he said "reader has no ability to access this service" and it doesn't let me move forward. -What this means and how do I continue to Word so I can change the pdf document?

    Hi wayned76005641,

    You subscription Adobe export to PDF, make sure that you are signed in DC from Adobe Acrobat Reader Adobe - Adobe Acrobat Reader DC Distribution using your Adobe ID to use the service to export it to PDF service The Adobe export in PDF format allows you to convert a PDF to Word, Excel, PowerPoint and RTF formats..

    You can also use this online https://cloud.acrobat.com/exportpdf service

    Once the PDF is converted .docx file you can edit in MS Word.

    Kind regards
    Nicos

  • How to convert an Indesign document and convert a continuous flow word document

    How to convert an Indesign document and convert a continuous flow word document?

    Thank you so much worked perfectly.

  • How do CUT you a word in Design CS 5.5?

    How do CUT you a word in Design CS 5.5?

    I understand how to apply "NO BREAK" - but how do force you a break?

    Ceencha wrote:

    How do you force a break?

    Place the cursor where you want the link and press the hyphen key.

    Or ask yourself how to control where the link will be inserted a break is necessary but not when the word has no need to break, which is not the same as forcing a hyphen. Who called a conditional dash and can be inserted by using the context menu to insert a special character > hyphenation and dashes > conditional dash.

    You can also add favorite of hyphenation of a Word and add it to your user dictionary.

  • How do I continue to use my mini v1 after iOS 10?

    I won't throw my mini v1. How do I continue to use it after iOS 10?

    Hello

    If you have an iphone / iPad, if it will not run the new ios 10 they will work ok on the latest ios Update 9 or below.

    See you soon

    Brian

  • How can I stop this &gt; a script on this page may be busy, or it may have stopped responding. You can stop the script now, or you can continue to see if the script ends. Script: file:///C:/Program%20Files/Mozilla%20Firefox/components/nsExtensionMana

    What is the cause of the WARNING when I open firefox and how can I fix it? > A script on this page may be busy, or it may have stopped responding. You can stop the script now, or you can continue to see if the script ends.

    Script: file:///C:/Program%20Files/Mozilla%20Firefox/components/nsExtensionManager.js:623 <

    This has happened

    A few times a week

    From what I can tell, you have the toolbar installed, and which is known to cause problems. Go in Tools > Modules > Extensions, select the Ask toolbar, click disable , and then restart Firefox.

    If it does not, your troubleshooting details. See using the page of troubleshooting information to help solve the problems of Firefox

  • How can I add a Word to the lexicon? that is, how to stop my e-mail name AutoCorrect?

    How can I add a Word to the lexicon? that is, how to stop my e-mail name AutoCorrect?

    Greetings bonbog,

    You can add words to the spelling on your Mac dictionary. See this help page - check spelling and Grammar - Help Mac

    Specifically -.

    • Add words to the spelling dictionary: Control-click on a Word, then choose memorize spelling. The Word will not be marked as spelled in any document. To have the word marked as wrong spelled once again, the control key in a document, then choose unlearn spelling.

    Thank you for using communities of Apple Support.

    Be well.

  • How do I continue my AppleCare Protection?

    I have a 15 macbook Pro retina and my AppleCare protection expires: November 27, 2017.
    How do I continue my AppleCare Protection?

    My serial number: C02NP7LUG3QD

    There is no method to extend the AppleCare warranty, beyond its expiration date.

  • How to highlight the part of the tree?

    Hello everyone!

    I have a question: how to highlight a part of the tree on a condition? (please see the attached vi and the pictures for a clearer explanation of the problem)

    I'm using LabView 2014.

    Thank you very much!

    Have patience.  You only aske the question about 40 minutes earlier.

    You highlight the lines you want by writing the values to the control.  Don't mess with the background color of cell.

    You try to highlight several items?  If so, then right-click on the control and let him choose 0 or more elements.  As soon as you select a mode with the possibility of more than one element, the values of the tree becomes an array of strings, rather than just a string.  You need build an array of strings that you will write to a local variable of the control to highlight the various elements.

  • How to highlight all of the text control / seeing?

    I need a VI, just by pressing a button I could selects all the text in the control or the indicator to be able to copy then pressing CTRL + C.

    I tried to play with the property with selection of startup, select the end node, but no results.

    Also did not find any documentation or examples on how to highlight the text in the indicator.

    Could someone help with this?

    Any tips/tip much appreciated.

    Thanks in advance.

    Help for 'selection' mentions that you have to set the Focus to the first control.

    There is also a System method to copy a string into the system Clipboard.

    Tone

  • How to read continuously from the rs232?

    Hello

    I'm new to LabVIEW and my questions would be obvious for some for you. So please help if you know the solution.

    It's for my school project. For your information, we need to schedule a Committee of Altera DE2 to control traffic lights (something like that) and at the same time, the Commission shall forward the States of enlightenment to a computer with LabVIEW installed via an RS-232 cable.

    The rest of the project was fine except for the part of LabVIEW, because as I said earlier, I'm new to LabVIEW.

    We use the "basic series write and Read.vi" in the folder examples of NEITHER. The problem is that we do not know how to change the vi in order to receive the data that come the DE2 Board permanently. Each time, the vi stops reading after receiving 24 bytes of data.

    So, the first question is:
    1.) how to read continuously from the RS-232 port? (We tried to use while "loop" but without success, maybe we were doing it the wrong way.) If you know the solution, please enlighten us for us in a detailed manner.

    (2) Secondly, once we have received the 'chain', how can convert us to bits (0 and 1) so that we might be able to manipulate the bits, for example turn on the LEDs that correspond to the bits.

    Thank you.

    Instead of reading the bytes of the port so to read that many bytes (which may be zero), just do a VISA read for 1 byte.  He will wait for this next byte.

    To get an array of Boolean out of this byte, use this code.  He turns the characters into a byte array.  Takes the first and the only element of this array, and then converts this single U8 number into an array of bytes.

    Which country are you?  I've never seen or heard lights orange before.  Only the yellow lights.

  • How can I change the words in the spell checker?

    I've saved an incorrect word in my spell checker in Windows Mail and now can't change it. I tried to change my English version, but it seems that all of my custom entires are moving to the new version. Any suggestions would be helpful.
    Thank you!

    How do I change a word in the custom dictionary for the Spell Checker in Windows Mail
    http://www.Vistax64.com/tutorials/82062-Windows-Mail-spell-checker-dictionary.html

    Bruce Hagen MS - MVP [Mail]

  • How to open just the word from a flash drive files

    How to just open the word files from a flash drive, do not see the excel files that I saved to the flash drive

    Launch Word.

    File open - navigate for flash player and select file/s that you want to open.

    Verify that Word is set to show only the only Word documents and any documents

  • How can I get a Word and Excel shortcut on my desktop in windows 8?

    How can I get a Word and Excel shortcut on my desktop in windows 8?

    Thank you
    Steve

    How to put Excel on the DESKTOP.
    FromWwindows 8, open "File Explorer".
    Click on this file:
    C:\Program Files\Microsoft Office 15\root\office15
    Find the icons excel or word or powerpoint that you want on the DESKTOP
    Right click on it.
    "Send to"-"Office".

    It took me forever to understand.  I have my windows 8 looking like/work like XP or Windows 7.

  • How to convert PDF to WORD DOC

    How to convert PDF to WORD DOC

    Hello

    It is possible conversion of PDF to word, PDF to Word Converter doc | Adobe Acrobat DC where you can use 'try Acrobat Pro DC for 30 days. Start free trial"I personally use so too a Word built-in converter."

    Hans-Günter

Maybe you are looking for

  • 9.3.5 iOS safari crashes

    Since the upgrade to iOS 9.3.5, safari has a tendency to crash often. Is this a bug? Is there any solution for this?

  • Why is there no other choice "45 minutes" to the title of travel time?

    I like the ability to add travel time to an event, but I am frustrated that I have to choose between 30 minutes or an hour.  45 minutes would be ideal, but it is not included in the selection. Why not?

  • Nothing is printing because a job is CANCELING

    I have a feeling which was cancelled 5 days!  Because of, I believe that nothing is printing.  I tried everything I could think of power, reset, cancel the account and open a new one with a new ID (impression being canceled was always there), etc. Is

  • disable the driver updated or cancel without saving changes

    I have a question. If a glance in one pilot recommended LabVIEW to ' save changes before closing? But I did no seals (only press a stop button, on and offf once again). The I want to close the driver without savings. Then I can just slect "Save, Defe

  • 1. complete 16-bit

    Hello, I need to calculate from a hexadecimal string of the 16 bits in addition to the complement of all 16-bit words in the header and data. the chain is the next 7E03 00FE 2010 0000 000 C and the calculated checksum of it's 60E2 The description is