the orphan of widows line script

Hello

I want to find the lines 'widows and orphans' in my active document, if its (window orphan) appeared, I need the report log. Is it possible by script.

by

hasvi

Hi Hasvi,

This is the one modified. If this is fits your needs then mark reply Jarek is OK.

var reportwidow = "Suite pages have widow line \r\r", reportorphan = "Suite pages have an orphan line \r\r";

var firstParas = app.activeDocument.pages.everyItem (). textFrames.everyItem (). textColumns.everyItem () .parag raphs [0] .getElements ();

var lastParas = app.activeDocument.pages.everyItem (). textFrames.everyItem (). textColumns.everyItem raphs [-1] .parag () .getElements ();

for (var i = 0; i)<>

{

try {}

var fline1 = firstParas [i] .lines [-1] .textColumns [0];

var fline2 = firstParas [i] .lines [-2] .textColumns [0];

}

{catch (e)}

If (firstParas [i]. Lines.Length > = 2)

{

If (fline1! = fline2)

{

reportwidow += firstParas [i] .lines [-1] .parentTextFrames [0].parentPage.name + ",";

}

}

}

for (var i = 0; i)<>

{

try {}

var Lline1 = lastParas [i] .lines [0] .textColumns [0];

var Lline2 = lastParas [i] .lines [1] .textColumns [0];

}

{catch (e)}

If (lastParas [i]. Lines.Length > = 2)

{

If (Lline1! = Lline2)

{

reportorphan += lastParas [i] .lines [0] .parentTextFrames [0].parentPage.name + ",";

}

}

}

var w = app.activeDocument;

var monFichierTexte = new File ("~/Desktop/widow orphan.csv")

myTextFile.open ("w")

myTextFile.write("\nreportwidow:")

myTextFile.write (reportwidow)

("myTextFile.write("\n\nreportorphan: ")

myTextFile.write (reportorphan)

myTextFile.close ();

Kind regards

Cognet

Tags: InDesign

Similar Questions

  • Help with a script that detects the content in a cell and apply the cell style to line

    Hello


    I am trying to add an article to my table formatting script that is a cell with the word 'Budget' (but this can be written as ' Budget:' or ' Budget: (E) "- but without the speech marks) and apply the cell Style - SponsorCells - to all the cells of the whole line. I currently have on what it will, but it does not work:


    function checkWhichTable()
    {
    // ensure the user made a selection
    if (app.selection.length != 1)
    return null;
    var currentTable = app.selection[0];
    if (currentTable.hasOwnProperty("baseline"))
    {
    currentTable = app.selection[0].parent;
    }
    while (currentTable instanceof Cell || currentTable instanceof Row || currentTable instanceof Column)
    currentTable = currentTable.parent;
    if (!(currentTable instanceof Table))
    {
    // No table selected
    return null;
    }
    return currentTable;
    }
    app.doScript(checkUserSelection, ScriptLanguage.JAVASCRIPT, undefined, UndoModes.ENTIRE_SCRIPT, "Process Table");
    
    
    function checkUserSelection ()
    {
    var a_table = checkWhichTable();
    if (a_table == null)
    {
    if (confirm("No table selected. Do you want to process *all* tables?") == false)
    return;
    allTables = app.activeDocument.stories.everyItem().tables.everyItem().getElements();
    for (aTable=0; aTable<allTables.length; aTable++)
    {
    processTable (allTables[aTable]);
    }
    } else
    {
    processTable (a_table);
    }
    }
    function processTable(table)
    {
    // do something here!
    
    
    //Set 1st Row Height
    table.rows[0].height = "30mm";
    
    
    //Find Text in Cell and apply Cell Style to Row 
    var  
      myCellText=['Budget', 'Budget:', 'Budget: (E)'];  
     var myRegEx = new RegExp("^("+myCellText.join("|")+")$");
      for (i=0; i<table.cells.length; i++)
      {
        if (table.cells[i].texts[0].contents.match(myRegEx))
          table.cell[i].appliedCellStyle = "SponsorCells";
      }
    
    
    //end - do something here!
    }  
    


    I can get the script to apply the cell style to "SponsorCells" for each cell that contain the word 'Budget' etc, but I need cell ever on this line to have the cell style applied. I tried to re-write line 56 which applies the style to a cell, but I can't seem to make it work. Any help would be great.


    Separate on this issue, I would like to have a line of code similar to the 46 line, which sets the 1st height of lines, but I would like to say "If a cell has 'A cell Style' and then applies the value height 10 mm". If someone could result as a help of bonuses, things would be great double.


    Thanks in advance!

    But that could be painfully slow. To speed things up, follow these steps:

    var cells = table.cells.everyItem().getElements();
    for (var i=0; i
    

    It is faster, because it creates an array of cells with a call to table.cells, which is several times faster than calling table.cells. And before assigning to line 12mm height is useful to check if it is already 12 mm. checking things in InDesign and do things only when it is necessary is much more effective than simply doing things even if they are not necessary.

  • Join the host ESX to Virtual Center via the command line script

    Question for the guru-, we are spinning up to our servers ESX 3.5 using HP OpsWare. It would be very helpful if someone could point me in the direction of a function/command line script that I could launch the ESX Server, allowing him to join a server VC.

    Thanks in advance

    Caisse hostops.pl included in the VIMA/vMA or the VIPerl Toolkit.  Does exactly this.

    -Matt

    VCP, vExpert, Unix Geek

  • Cannot use the Val function in a script use

    I'm trying to convert a text string (binary number) in a number by using the Val function in a script of use but the colors of tiara the term Val in red and the script produces an error indicating "Variable is undefined:"Val"

    Why is that happen? Some functions are not allowed in use scripts?

    In addition, it seems impossible to use debugging in my use - if I try to add a variable to the Watch window, there never have any value even if I put a breakpoint on this line of code. Would it not possible to debug scripts use?

    David,

    regarding your question on "Val" I would like to direct you to the "File.Formatter.ParseString" function which is part of the API available at DataPlugins.

    CDbl and CLng do a good job in general, but they are dependent on the local configuration of the PC. 'ParseString' is so much more reliable.

    Andreas

  • How to make SQL * more count the comment and blank line numbers?

    Hello

    Parameter
    Value of the parameter
    Oracle versionEnterprise Edition Release 11.2.0.1.0 - 64 bit
    OPERATING SYSTEMLinux Fedora Core 17 (X86_64)

    I would like to know, is it possible to force SQL * Plus to provide the number of the current in the source file line whenever there is an error? I often put in the first line of my script SQLBLANKLINES the VALUE ON that I may be able to put several consecutive blank lines in my code (I do that sometimes, when I find that it is appropriate to make my code more readable or a sequence of instructions which I believe make their logic more comprehensible for the reader of the Group)

    Now the problem is that SQL * Plus will ignore these empty lines and whenever there is an error, the line number in the error message does not match the actual line number in the source file, but it seems to be the last non-empty line in the file.  Consider the following example:

    SET SQLBLANKLINES ON;

    DECLARE
        var PLS_INTEGER := 10;
    BEGIN


       
        var := 20
    END;
    /

    In the code above on line 9 (also counting blank lines), there is an error (no semicolon at the end of the var: = 20) but when I run the script

    SQL * also, here is the error message I get


    SQL > @myscript.sql;

    END;

    *

    ERROR on line 8:

    ORA-06550: line 8, column 1:

    PLS-00103: encountered the symbol "END" when expected in the following way:

    * & = - + ; <>/ is mod remains not rem

    < an exponent (*) > <>or! = or ~ = > = < = <>and like2 or

    like4 likec between | submultiset of type multiset Member

    The symbol ';' was replaced by 'END' continue.


    SQL >


    As you can see the error message indicates that the error was found on line 8, while in the file, it's really on line 9

    As long as the number of lines in the script is limited, this may not be a problem and we can quickly find the actual line number in the code that causes the error, but for a code, including hundreds (or even thousands) of lines and with many comments and blank lines, find line number given by SQL * error message more becomes complicated.

    So my question: is it possible to make SQ * more properly draw the line numbers, as they appear in the source file?

    Thanks in advance,

    Kind regards

    Dariyoosh

    Hi, Dariyoosh,

    The line numbers in error messages are always from the beginning of the statement, but not the file.  The back-end which checks the errors and generates the error message, has no idea if this statement has appeared in your file, even if the statement was in a file at all, or if it comes from multiple files, each with its own line 1.

    You can divide your scripts into parts, so that the long statements, which may lead to error messages, are each in a separate file, so the statement starts on the line 1 of the file.

    For example, you can call a script called fubar.sql, which looks like this:

    SET SQLBLANKLINES ON;
    
    @@fubar_1
    

    Which calls another script, called fubar_1.sql, located on the same directory as fubar.sql, that looks like this

    DECLARE
        var PLS_INTEGER := 10;
    BEGIN
    
        var := 20
    END;
    /
    

    You never call him directly fubar_1.

  • Problem to find the Position of the cursor by using Java Script for an input TextField

    Hello

    I have a problem to find the position of the cursor in a field inputText component.

    The following code of java script to achieve. The same functionality works fine if I run in a simple html page. But when it is used the same javascript inside the jsff does not the position of the cursor.
    var adfComponent = AdfPage.PAGE.findComponentByAbsoluteId("r1:1:it3");
    var adfComponentClientId = adfComponent.getClientId();
    var div = document.getElementById(adfComponentClientId + '::content');
    div.focus();
    var docSelectionRange = document.selection.createRange();
    
    docSelectionRange.moveStart ('character', -div.value.length);
    
    var iCaretPos = docSelectionRange.text.length;
    
    alert("iCaretPos --> "+iCaretPos);  ---> This statement always returning '0'. Instead, i want the cursor position inside the text box.
    Please let me know what I'm missing.

    For your reference, sending the sample page html that works fine with the same kind of code.
    <html>
     
     <body style="font-family: tahoma; font-size: 8pt;">
     
      <script language="JavaScript">
     
       /*
       **  Returns the caret (cursor) position of the specified text field.
       **  Return value range is 0-oField.length.
       */
       function doGetCaretPosition (oField) {
     
         var iCaretPos = 0;
              alert(oField);
         if (document.selection) { 
     
           // Set focus on the element
           oField.focus ();
     
           // To get cursor position, get empty selection range
           var oSel = document.selection.createRange ();
     
           // Move selection start to 0 position
           oSel.moveStart ('character', -oField.value.length);
     
           // The caret position is selection length
           iCaretPos = oSel.text.length;
         }
     
         // Firefox support
         else if (oField.selectionStart || oField.selectionStart == '0')
           iCaretPos = oField.selectionStart;
     
         // Return results
         return (iCaretPos);
       } 
      
     
     
      </script>
     
      <form name="blah">
     
       Text Field: <input type="text" name="nameEdit" value="">
       <input type="button" value="Get Caret" onClick="document.getElementById('where').value=doGetCaretPosition (document.forms[0].elements[0]);">
    <input id="where">
      
     
      </form>
     
     </body>
     
    </html>
    Thank you and best regards,
    Kiran kristelle

    Published by: Kiran kristelle on February 6, 2012 12:00

    ... had the chance to look at the source code of the sample. ADF Faces renders text as HTMLTextArea fields when the value of the rows property. The JavaScript code used in the example of client works differently for FF and IE if the input is a text box. This could be a problem in IE or just used JavaScript code. The rows back to a single line (remove) property makes the text as HTML input feldworking with the JavaScript for IE and FF.

    Frank

  • is it possible to add a word at the end of a line?

    Hi, I'm looking for a way to automatically add a word at the end of a certain style of paragraphs?

    is it possible to do it using a script?

    I'm script, but if someone could find me a way to do this would be really appreciated.

    Here is an example of what I need to do:

    I have the X paragraph style in a document of current book, and I need to edit the book and add the source of the copyright at the end of each line that has X style him

    so I need something that wonder

    1. the targeted paragraph style
    2. What word I want to add to it and then apply it rigorous document.

    Thanks in advance

    You don't need a script for this, you can use a Grep search/replace.

    Search: (.) $

    and set your paragraph style in the format of find

    Change: $1XYZ

    where XYZ is the text you want to insert.

    Peter

  • JS CS3: Help reduce the execution time of my script

    Hello

    We have developed a script to find the words/characters similar to the beginning/end of continuous lines 3 or more. The script was developed by following the steps:

    1. get all the lines of the document;

    2. get the first 2 characters of the first line and to compare with the first 2 characters of the two lines.

    3. If the matches, then don't give a no pause after the word to flow.

    The same procedure to search for characters from end of lines.

    Our documents with more than 300 pages, the script runs too long (about 15 minutes) per document.

    Might suggest to shorten the script running?

    My sript base is:

    for (k = 0; k < myStory.paragraphs.item (i).lines.length; k ++) {}

    var myParaText = myStory.paragraphs.item (i);

    var myChar2Fa = myParaText.lines [k].characters.itemByRange (0.1) .texts [0] .silence;
    var myChar2Fb = myParaText.lines [k + 1].characters.itemByRange (0.1) .texts [0] .silence;
    var myChar2Fc = myParaText.lines [k + 2].characters.itemByRange (0.1) .texts [0] .silence;

    If (myChar2Fa == myChar2Fb & & myChar2Fa == myChar2Fc) {}
    myParaText.lines [k + 2] .characters [-1] .noBreak = true;
    }

    Please suggest.

    concerning

    Lionel Messi

    Every interaction with the costs of model object - in this case, request ID paragraphs.item (i) .line, itemByrange(), etc. Avoid this problem by storing as much as possible directly referred to in variables.

    Every interaction with the text of the document itself costs too - you will see that the script runs a lot faster if you only account the number of occurrences. (But this cannot be avoided).

    That said, your way to recover the first 2 characters per line is rather clumsy... My version still takes the odd minute or two, for a 300-page test document, but I think it's mainly because ID must re - flow each paragraph that it changes.

    myStory = app.selection[0].parentStory;
    ln = myStory.lines;
    n_ln = ln.length;
    for (i=0; i 1 &&
      ln[i].contents.substring(0,2) == ln[i+1].contents.substring(0,2) &&
      ln[i].contents.substring(0,2) == ln[i+2].contents.substring(0,2))
     {
      ln[i+2].characters[-1].noBreak=true;
     }
    }
    

    I am not convinced that is what you intend: avoiding three consecutive lines to begin with the same two characters. First, of course you will have to run again, as reinvesting the text can move another word on the front of the line with these same characters.

    Second:-[1] is a special index in InDesign. It does not point to the point before the current (as it would if - 1 was treated the same as 0, 1, and 100), but instead it counts backward from the end of the indexed item - in this case, No Break is applied to the last character of line 3. I bet you have to apply to the last character in the 2nd line (which, if so, is easy fixed).

  • A question about the order of the COIL and blank lines

    Hello everyone,



    I have a question on the order of the COIL. Here is the syntax of my sql script file
    HOST SET NLS_LANGUAGE=FRENCH_FRANCE.WE8MSWIN1252;
    SET SQLBLANKLINES ON;
    SET TRIMSPOOL ON;
    SET SERVEROUTPUT ON;
    SET LINESIZE 10000;
    SET PAGESIZE 10000;
    SET COLSEP '|';
    SET HEADING OFF;
    SET ECHO OFF;
    SET FEEDBACK OFF;
    SPOOL result.txt
    
    
    -- And here I write my sql queries.
    
    
    SPOOL OFF;
    It works quite well, and every time the script is run, the file ' * result.txt "* contains the result of the request." " However, whenever there is a blank line at the beginning of the file ' * result.txt* '. I don't know why this unwanted blank line is inserted automatically whenever I run my script. I have to delete manually (otherwise I have problems with my script Unix interpret these files) and as I have several files to update, this could be your time. Is it possible to get rid of this unwanted blank line?


    Thanks in advance,


    Kind regards
    Dariyoosh

    SET PAGESIZE 0;

  • Firefox does not open after the update. Cannot open the profile technical, even when you use the directory in cmd line path

    I'm using Firefox on a Windows 7 computer. Firefox does not open after the last update. I read the help articles and it seems that I need to create a new profile because my settings were probably corrupted. I'm unable to open the profile technical, even when you use the directory in cmd line path. I tried the following commands in the command line:

    Firefox Pei
    "C:\Program Files (x 86) \Mozilla" PEI

    Nothing happens with every order.

    I am also running Norton Internet Security. I read a help of virtual navigation features Re article that can cause a problem. The article says to check the setting of virtualization in the internet security software and to clear the virtual cache. I went through all the menus of settings in Norton Internet Security version 21.6.0.32 and I don't see anything that looked like in "virtualization" settings, so I guess that does not apply to me. "

    If you have any ideas, I had appreaciate that your expertise!

    Hello arcandl, at the launch of the firefox is not after you double-click the shortcut, it is sometimes also a sign of active malware on a system.
    you might want to try running a scan with some various other security like the free version of malwarebytes and adwcleaner tools that are specialized to remove the adware and browser hijackers.

    Fix Firefox problems caused by malicious software

  • hit the tab opens another line of address rather than go to the subject field

    With the last update to Thunderbird, I can not tab directly from the field address within the scope of the topic. Hit the tab opens another line of address to be removed, then tab will move to the scope of the topic. I hope someone solves this problem quickly.

    In my version 31.2.0
    It depends on how MANY fields are automatically inserted.

    So if I have 3 set as default, but have used an email address, tab scrolls the (two) other TO and in THE fields and then go to topic.

    The rest to THE fields may not necessarily appear if the content by separating the divider was raised to provide more space to strike. So it might appear as though the creation of a new FIELD (which is normally when you press the enter/return key), but it's actually only to already available in THE fields.

    To check this:
    Open a new message of Scripture.
    Lower the separator bar to reveal header space, all the fields to display and also a few extra empty lines.
    How many auto fields appear?

    Place the cursor at the top of the page to and use Tab to move.
    the move of the tab should move from FIELD to the fall of choice FOR down, then next field. When the last FIELD was used, tab should go to the question, it should not go to an empty field AND create a new FIELD.

  • New AOL e-mail: one quarter of the screen is blank on the right side, reducing the space for the e-mail subject line. Resize attempts do not work on the right side, so I can't expand the e-mail subject line

    The new AOL E-mail look, which yesterday began a quarter of the screen is blank on the right side, thus reducing the space for the e-mail subject line, which limits its usefulness. Resize attempts do not work on the right side, so I can't expand the e-mail subject line? Running XP pro and Mozilla Firefox 5. No problem with I.E.

    Thank you, these settings were already in place. AOL said now erase the cache, cookies and history... to solve, which worked. (I deleted the cache and a story time.)

  • What are the causes of horizontal lines punched in the photos

    I own a 3310 all in one and it started showing perforated horizontal on the picture when completed lines.

    My cousin came to look at the printer.

    He found some lint on the wheel. He took a very small hook and removed from the star wheel.

    Everything works fine and prints great photos

  • The quotes appear automatically at the end of each line

    Normal return at the end of a line of text create quote marks, shift return has not, anyone know of a way to stop this? Located mainly on older presentations which were brought in more recent versions of Keynote. It doesn't seem to be a problem of quote auto that nothing appears at the beginning of each line.

    Never heard of this issue. Try the following:

    1. open a new presentation and then drag and drop the original in the new slides,

    2 - Copy and paste the text of the original in a new text box in a new presentation.

  • SMU-6556 - how to control the rise in digital lines (hsdio) time

    Hello

    Is it possible to control the rise in digital lines SMU-6556 time?

    Even in a low frequency 10 kHz signal rise time is 2ns.

    TKS,

    Hello engfpe,

    The SMU-6556 is a 50 Ohm system, which means that the output is source series finished to be 50 Ohms and all our cables and accessories are 50 Ohms.  With this configuration, regardless of the flow of data, you should have a clean edge up or down, regardless of the data rate. The quality of the production (edge up or down) on your device is related to the adaptation of impedance of your cables.

    The SMU-6556 cannot adjust the speed of scanning by itself.  However, you can insert simple passive components to do it for you.  I have attached below the images.  The first is a diagram showing a way to slow down the edge.  The second is the a waveform simulation showing the rate of original edge before it slows down and the edge of idle.   This simulation is not the SMU-6556 but rather a generic digital output for concept.  In the schema that R1 is set on 34 Ohms because U1.8 has the 16 additional Ohms on the inside.  TL1 is the output of 50 ohms simulating the cable on the SMU-6556.  R2, R3, and C1 are components, you can insert after the SMU-6556 twist before moving your device/cable.  In this configuration from cable to your device is TL2 which is also 50 ohm, but it could be another impedance in which case you would change R3 to match.

    You can see in the attached images, you can slow down significantly the edge with this configuration by altering the C1.  I hope this helps.

Maybe you are looking for