Apply the Condition to the content of paragraph

Hello

I want to apply a condition to a paragraph. In some cases, I only want to apply the condition until paragraph return, but does not include the return. Here's a function that works for entire paragraphs, but I'm not sure what to use when I want to let the unconditional return. Any help would be appreciated.

function applyCondition (pgf, condName, includeReturn, doc) {
    
    condName = String(condName);
    var condFmt = doc.conditions.itemByName(condName) ;
    if (condFmt.isValid === false) {
        // If the condition does not exist, create it.
        doc.conditions.add ({name: condName});
    }

    // Make sure the condition is visible.
    condFmt.visible = true;
    
    if (includeReturn === true) {
        // Apply the condition to the entire paragraph.
        pgf.applyConditions (condFmt, true);
    } else {
        // Apply the condition to the paragraph up to the return.
    }
}

Rick

Hi Rick

I think there must be a myriad of solutions for that one.

Probably the simplest is:

pgf.characters.itemByRange(0,-2).applyConditions (condFmt, true);

That's assuming that "TFP" is a reference to a paragraph of the object.

Concerning

Trevor

Tags: InDesign

Similar Questions

  • Apply the style of paragraph 1 above and the style of paragraph 3 below all paragraphs containing only the italics?

    Hello

    I need a script that can find the paragraphs in italics only glyphs (maybe we can change all that pretty color) and apply the style of paragraph 1 above, the style of paragraph 3 below and this paragraph in italics to paragraph style 2

    Some paragraph of text (for the 1 paragraph style)

    some italic text (for paragraph style 2)

    little text (for the 3 paragraph style)

    After you run the script, I have something like this in 3 styles different points

    a text

    some italic text

    a text

    Lost link!

    /*

    Fixing paragraph style combinations

    Version: 1.2.B

    Script by Thomas Silkjaer

    http://indesigning.NET/

    Minor version b: Bruno Herfst

    + Add any style to replace paragraphs

    + Can cancel

    */

    var the_document = app.documents.item (0);

    Create a list of paragraph styles

    var list_of_paragraph_styles = [];

    var all_paragraph_styles = [];

    the_document.paragraphStyles.everyItem () .name;

    for (i = 0; i< the_document.paragraphstyles.length;="" i++)="">

    list_of_paragraph_styles.push (the_document.paragraphStyles [i]. (Name)

    all_paragraph_styles.push (the_document.paragraphStyles [i]);

    }

    for (i = 0; i< the_document.paragraphstylegroups.length;="" i++)="">

    for (b = 0; b< the_document.paragraphstylegroups[i].paragraphstyles.length;="" b++)="">

    list_of_paragraph_styles.push (the_document.paragraphStyleGroups [i] .name + ' /' + the_document. paragraphStyleGroups [i] .paragraphStyles [i] .name);

    all_paragraph_styles.push (the_document.paragraphStyleGroups [i] .paragraphStyles [i]);

    }

    }

    var list_of_replace_paragraph_styles = list_of_paragraph_styles.slice (0);

    list_of_replace_paragraph_styles.unshift ("[no paragraph style]" "");

    That the dialog box to select the paragraph styles

    var the_dialog = app.dialogs.add ({name: 'Paragraph style pairs Fix'});

    {with (the_dialog.dialogColumns.Add ())}

    {with (dialogRows.Add ())}

    staticTexts.add({staticLabel:"Find:"});)

    }

    {with (borderPanels.Add ())}

    var find_first_paragraph = dropdowns.add ({stringList:list_of_paragraph_styles, selectedIndex:0});})

    staticTexts.add ({staticLabel: "monitoring of"});

    var find_second_paragraph = dropdowns.add ({stringList:list_of_replace_paragraph_styles, selectedIndex:0});})

    }

    {with (dialogRows.Add ())}

    staticTexts.add({staticLabel:"Change:"});)

    }

    {with (borderPanels.Add ())}

    var change_first_paragraph = dropdowns.add ({stringList:list_of_paragraph_styles, selectedIndex:0});})

    staticTexts.add ({staticLabel: "monitoring of"});

    var change_second_paragraph = dropdowns.add ({stringList:list_of_paragraph_styles, selectedIndex:0});})

    }

    }

    {if (the_dialog. Show())}

    Define paragraph styles

    var find_first_paragraph = all_paragraph_styles [find_first_paragraph.selectedIndex];

    anyStyle var = false;

    If (find_second_paragraph. SelectedIndex == 0) {}

    anyStyle = true;

    }

    var find_second_paragraph = all_paragraph_styles [find_second_paragraph.selectedIndex - 1];

    var change_first_paragraph = all_paragraph_styles [change_first_paragraph.selectedIndex];

    var change_second_paragraph = all_paragraph_styles [change_second_paragraph.selectedIndex];

    Set preferences for grep to find to find all the points with the first selected paragraph style

    app.findChangeGrepOptions.includeFootnotes = false;

    app.findChangeGrepOptions.includeHiddenLayers = false;

    app.findChangeGrepOptions.includeLockedLayersForFind = false;

    app.findChangeGrepOptions.includeLockedStoriesForFind = false;

    app.findChangeGrepOptions.includeMasterPages = false;

    app.findGrepPreferences = NothingEnum.nothing;

    app.findGrepPreferences.appliedParagraphStyle = find_first_paragraph;

    app.findGrepPreferences.findWhat = ' $';

    Search current history

    var the_story = app.selection [0] .parentStory;

    var found_paragraphs = the_story.findGrep ();

    var change_first_list = [];

    var change_second_list = [];

    Browse the paragraphs and create a list of words and mark them as index words

    myCounter = 0;

    {}

    try {}

    Create an object to in paragraph reference and the following

    var first_paragraph is found_paragraphs [myCounter].paragraphs.firstItem ();.

    var next_paragraph = first_paragraph.paragraphs [-1] .insertionPoints [-1] .paragraphs [0];

    {if (anyStyle)}

    change_first_list.push (first_paragraph);

    change_second_list.push (next_paragraph);

    } else {}

    Check if the next paragraph is equal to the find_second_paragraph

    if(next_paragraph.appliedParagraphStyle == find_second_paragraph) {}

    change_first_list.push (first_paragraph);

    change_second_list.push (next_paragraph);

    }

    }

    } catch (err) {}

    myCounter ++;

    } While (myCounter<>

    Apply paragraph styles

    myCounter = 0;

    {}

    change_first_list [myCounter] .appliedParagraphStyle = change_first_paragraph;

    change_second_list [myCounter] .appliedParagraphStyle = change_second_paragraph;

    myCounter ++;

    } While (myCounter<>

    Alert ("fact pairs fixation!");

    }

  • Concatenation of the contents of paragraph

    Hello guys,.

    I'm on a script which is concatenation of a string to some elements of paragraph.  In fact, after concatenation, the formatting of the paragraph replaces by the first character in the paragraph (no paragraph style were used).

    myDoc var = app.activeDocument;

    var selection = myDoc.selection;

    var num_blocks = selection.length;

    for (var i = 0; i < num_blocks; i ++) {}

    If (.) Selection TypeName [i] == 'TextFrame') {}

    var selection [i] .paragraphs = paragraphs;

    for (var j = 0; j < paragraphs.length; j ++) {}

    paragraphs [j] .silence += 'xxx ';

    };

    }

    else {}

    do nothing

    }

    };

    Example:

    Capture.PNG

    The text is to have respected the original formatting, while the rear 'xxx' should have been formatted as "today".

    Would be grateful if someone could help.

    change this

    paragraphs [j] .silence += 'xxx ';

    for this

    Paragraphs [j]. Words.Add ('xxx');

  • Automatic table row apply the paragraph style

    Hello

    I am new to scripting in Indesign. I would like to write a script to apply a paragraph on a line style in a table like this:

    1 search for the string 'XX' in a table

    2. when the 'XX' string is found, apply a paragraph style named "ParA" to the line that contains the string "XX".

    3. apply a cell style named "CellA" to the cell that contains the sting "XX".

    4. apply the style of paragraph called 'Service' to the string "XX".

    5 search for the string "XX" to the end of the table

    Can someone help me?

    Hi Syd,

    For the selected table, use the below a.

    var doc = app.activeDocument,
        _tables = app.selection[0],
        i, j, k, l, a =0, _rows,_cells, rowlen; 
    
    _rows = _tables.rows;
    for(k =0;k<_rows.length;k++)
    {
        _cells = _rows[k].cells;
        for(l =0;l<_cells.length;l++)
        {
            if(_cells[l].contents == "xx")
            {
                rowlen = _cells[l].parent.cells.length;
                a = 0;
                while(rowlen--)
                {
                      _cells[l].parent.cells[a].paragraphs.everyItem().appliedParagraphStyle = doc.paragraphStyles.item("ParA");
                      a++;
                    }
                _cells[l].paragraphs.everyItem().appliedParagraphStyle = doc.paragraphStyles.item("ParB");
                _cells[l].appliedCellStyle = doc.cellStyles.item("CellA");
                }
            }
        }
    

    Kind regards

    Cognet

  • Do not apply the model templates to IndCS6

    Hello

    I have a 118 in the face of this document pages with 24 different master pages.

    I applied split master pages through the document, either by dragging the page master, left or right on the thumbnail page of the document in question.

    for example:

    page master P1 - 9A

    master page P10 - 16B

    master page P17 - 28 C

    P29-35 page master D

    etc.

    Where the pages face to face have different models, the thumbnail of the page shows the letter of the master page, but does not open the master page content.

    The left Page right page

    P16 = Master B p17 = Master C

    page 16 is showing page master B in the forecast of nail but apply the content of the Master C.

    All master pages correctly showed the last time I printed, so I'm not sure what I changed in the settings so that it can not not display correctly now?

    Thanks for your help

    Sue.

    Objects that are not actually touch the other half spread on the master? If they come out of the spinal column, a little that they would be there.

  • You can apply two condition tags to the same content?

    We must apply the two condition tags to the same content. A condition tag is for the version of the product (for example, full vs of lite), and the other condition tag is for the output (vs. Administrator's guide online help). Is it possible within the framework to apply two condition tags to this topic? We want a topic to have the full conditions of the Administrator's guide.

    If this is not possible, we can create a condition that is full tag and guide the administrator, but we have thought that we would check to see what is possible. Thank you!

    > So we need to use conditional expressions for this?

    If inclusive - or show, that's what you want, no.

    Otherwise, probably - I have not used cond-exps myself yet.

    Even in FM9/10, it is probably still a good idea to overlap do not conditions. Brainwashed MIF can fix, tho.

  • Add the tab character before the content of particular paragraph style

    I have to add the tab character before the content of particular paragraph style

    app.findTextPreferences.appliedParagraphStyle = app.activeDocument.paragraphStyles.item ("IDX2");

    list = app.activeDocument.findText ();

    // 2. For each found the point...

    for (i = 0; i < list.length; i ++)

    {

    App.Select (list [i])

    App.Selection[0].insertionPoints[0].contents="\t".

    }

    But the code above only works in the first instance. But I must add the tab character all the content of the paragraph applied

    How to do this

    Hello

    Another way without GREP...

    var doc = app.activeDocument;
    var myStories=doc.stories;
    var J= myStories.length;
    
    while( J-- ){
        var mStorie = myStories[J];
        var K= mStorie.paragraphs.length
        while( K-- ){
            if  (mStorie.paragraphs[K].appliedParagraphStyle.name == "toto") {
                mStorie.paragraphs[K].contents= "\t" + mStorie.paragraphs[K].contents;
            }
         }
    }
    
  • Then apply a pattern updated the content overlaps the previous contents

    Hello

    Massive headacke side... I really need to solve this problem – work on the line.

    I'm trying to update a site created by my predecessor offline. I've updated the model used, which created an insane amount of problems, more including fixed like today. When you try to update a single page using the template, the content of overlap. I find myself with 2 headers, footers 2 etc...  I thought it was because all the documents on the site (total 53, not too big) are detached from all models and the name of the editable regions on the documents do not exist, but even trying to match the areas to move the contents to the new regions just made a mess of things. My goal (I hope) is too simply update the site without going through all those contents that overlap. Please help, everybody.

    Here is my template code:

    <! DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional / / IN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" > ""
    "< html xmlns ="http://www.w3.org/1999/xhtml">".
    < head >
    < meta http-equiv = "Content-Type" content = text/html"; charset = utf-8 "/ >"
    < title > QMS: AFM < /title >
    < style type = "text/css" >
    <!--
    {body
    Police: 100% Verdana, Arial, Helvetica, without serif.
    Background: #666666;
    margin: 0; / * It is advisable to zero, the margin and the filling of the body to hold element has a different default browser * /.
    padding: 0;
    text-align: center; / * This centers the container in IE 5 * browsers. The text is then set left aligned by default in the #container selector * /.
    Color: #000000;
    background-color: #D7D7D7;
    background-repeat: repeat-x;
    border-bottom-color: #066;
    border-right-color: #066;
    border-bottom-color: #066;
    border-left-color: #066;
    }

    / * Tips for Elastic layouts
    1. Since the elastic layouts overall size is based on the user's default font size, they are more unpredictable. Used correctly, they are also more accessible for those who need larger fonts given the length of the line remains proportionate.
    2. sizing of the divs in this provision are based on 100% font size in the body element. If you decrease the overall size of the text by using a font size: 80% on the body element or the #container, remember that the complete provision will reduce proportionally. You can increase the widths of the divs to compensate for this.
    3. If the sizing of fonts is changed in different quantities on each div instead of on the overall design (ie: #sidebar1 is a font size of 70% and #mainContent has a font size of 85%), this will change proportionally each of the overall size of divs. You can adjust the base on your final sizing of fonts.
    */
    .twoColElsLtHdr #container {}
    Width: 46em;  / * This width will create a container that can fit in a 800px browser window if text is left to default browser font sizes * /.
    background: #FFFFFF;
    margin: 0 auto; / * margins (in conjunction with a width) auto Center the page * /.
    border: 30px no #C4C4C4;
    text-align: left; / * This setting overrides the text-align: center on the body element. */
    padding-left: 10px;
    background-color: #FFF;
    border-bottom-color: #C4C4C4;
    border-right-color: #C4C4C4;
    border-bottom-color: #C4C4C4;
    border-bottom-style: outset;
    border-left-style: outset;
    border-top-width: thick;
    border-right-style: outset;
    border-top-style: outset;
    border-left-color: #C4C4C4;
    border-right-width: thick;
    border-bottom-width: thick;
    border-left-width: thick;
    }
    .twoColElsLtHdr #header {}
    padding: 0 10px;  / * This filling is the alignment to the left of the items in the div that appear below. If an image is used in the #header instead of text, you can remove the padding. */
    background-color: #FFF;
    }
    .twoColElsLtHdr #header h1 {}
    margin: 0; / * zero setting of the margin of the last element in the #header div tag will prevent the collapse of margin - inexplicable space between divs. If the div has a border around it, this isn't necessary, which also allows to avoid the collapse of margin * /.
    padding: 10px 0; / * padding instead of margin will allow you to keep the edges of the div element * /.
    }

    / * Sidebar1″ tips:
    1 be aware that if you set a value for the font size on this div, the width of the div will be adjusted accordingly.
    2. as we work in ems, it is preferable not to use the filling in the sidebar itself. It will be added to the width for browsers compatible standards creating a real unknown width.
    3. the space between the wall of the div and the items it contains can be created by placing a margin left and right on these items as seen in the rule ".twoColElsLtHdr #sidebar1 p.
    */
    {.twoColElsLtHdr #sidebar1}
    float: left;
    Width: 12em; / * the background color will be displayed for the length of the content of the column, but no further * /.
    Padding: 15px 0; / * upper and lower padding create a Visual space within this div * /.
    background-color: #066;
    background-repeat: repeat-x;
    border-top-width: thin;
    border-top-style: none;
    border-right-style: none;
    border-bottom-style: none;
    border-left-style: none;
    border-right-width: thin;
    border-bottom-width: thin;
    border-left-width: thin;
    color: #FFF;
    padding-left: 0px;
    Clear: left;
    }
    H3 .twoColElsLtHdr # sidebar1″, .twoColElsLtHdr #sidebar1 p {}
    margin-left: 10px; / * the left and right margins should be to all of the items that will be placed in the side columns * /.
    margin-right: 10px;
    background-color: #066;
    text-decoration: inherit;
    }

    / * MainContent tips:
    1. If you give this div #mainContent a value of different size of the div # sidebar1″, the margins of the #mainContent div will be based on the font size and the width of the div #sidebar1 depend on the size of the font. You can adjust the values of these divs.
    2. the space between the mainContent and sidebar1″ is created with the left on the mainContent div margin regardless of how content div the sidebar1″ contains, the space of the columns will remain. You can remove the left margin if you want the #mainContent div text to fill the space of #sidebar1 when the content of #sidebar1 is complete.
    3. to avoid falling of float, you may have to test to determine the size of the image/approximate maximum element because this provision is based on the calibration of fonts the user combined with the values that you set. However, if the user has their browser game lower than normal font size, less space will be available in the #mainContent div that you see on the test.
    4. in the Internet Explorer conditional comment below, the zoom property is used to give the mainContent "hasLayout". This avoids several specific IE bugs that may occur.
    */
    {.twoColElsLtHdr #mainContent
    margin: 1.5em 0 0 13em; / right margin can be given in pixels or ems. He created space on the right side of the page. */
    color: #069;
    background-color: #FFF;
    border-top-style: none;
    border-right-style: none;
    border-bottom-style: none;
    border-left-style: none;
    }
    .twoColElsLtHdr #mainContent a: link {}
    text-decoration: none;
    color: #069;
    }
    .twoColElsLtHdr #mainContent a: visited {}
    text-decoration: none;
    color: #069;
    }
    .twoColElsLtHdr #mainContent a: hover {}
    text-decoration: underline;
    color: #069;
    background-color: #FFF
    }
    .twoColElsLtHdr #mainContent a: active {}
    text-decoration: none;
    color: #069;
    }
    .twoColElsLtHdr #footer {}
    padding: 0 10px;
    line-height: 0pt;
    color: #069;
    background-color: #FFF;
    do-size: 10px;
    }
    .twoColElsLtHdr #footer p {}
    margin: 0; / * zero setting the margins of the first element in the footer will avoid the possibility of the collapse of the margin - a space between the div tags * /.
    padding: 10px 0; / * padding on that element will create space, just as it would the margin, free margin collapse question * /.
    background-color: #FFF;
    }

    / * Various classes for reuse * /.
    .fltrt {/ * this class can be used to float right to the item in your page.} The floating element must precede the element it should be next to the page. */
    float: right;
    left margin: 8px;
    }
    .fltlft {/ * this class can be used to float an element on your page to the left * /}
    float: left;
    right margin: 8px;
    }
    .clearfloat {/ * this class must be placed on an element div or break and should be the last item before closing a container should completely contain a float * /}
    Clear: both;
    height: 0;
    font size: 1px;
    line-height: 0px;
    }
    H1 {}
    color: #069;
    do-size: 16px;
    border-bottom-color: #069;
    border-top-width: thin;
    border-right-width: thin;
    padding-right: 0px;
    padding-left: 0px;
    }
    body, td, th {}
    do-family: verdana;
    text-decoration: none;
    color: #069;
    border-bottom-color: #069;
    border-right-color: #069;
    border-bottom-color: #069;
    border-left-color: #069;
    border-top-style: solid;
    border-right-style: solid;
    border-bottom-style: solid;
    border-left-style: solid;
    border-top-width: thin;
    border-right-width: thin;
    border-bottom-width: thin;
    border-left-width: thin;
    }
    a: link {}
    text-decoration: none;
    color: #FFF;
    }
    a: visited {}
    text-decoration: none;
    color: #FFF;
    }
    a: hover {}
    text-decoration: underline;
    color: #FFF;
    background-color: #;
    background-repeat: repeat-x;
    background-position: center;
    border-bottom-color: #069;
    border-right-color: #069;
    border-bottom-color: #069;
    border-left-color: #069;
    }
    a: active {}
    text-decoration: none;
    color: #FFF;
    border color: #FFF;
    padding-left: 20px;
    }
    ->
    < / style > <!-[if IE] >
    < style type = "text/css" >
    / * place patches css for all versions of Internet Explorer in this conditional comment * /.
    .twoColElsLtHdr #sidebar1 {padding-top: 30px ;}}
    .twoColElsLtHdr #mainContent {zoom: 1; padding-top: 15px ;}}
    / * the owner above zoom gives IE the hasLayout property, avoid several bugs * /.
    < / style >
    <! [endif]-->

    "" < link href = "file:///U|/AFM/Dreamweaver/Left sidebar.css" rel = "stylesheet" type = "text/css" / >
    < / head >

    < body link = "#006699" class = "twoColElsLtHdr" >
    < div id = "container" > <!-TemplateBeginEditable name = "Header"->
    < div id = "header" >
    "" "" < h1 > < img src = "file:///P|/RPS/AFMS/Quality Management System/QMS website/ENGLISH SITE/Assets/pwgsc-e.gif" width = "364" height = "33" align = "left" alt = "wordmark" / > < img src = "file:///P|/RPS/AFMS/Quality Management System/QMS website/ENGLISH SITE/Assets/wordmark_canada.gif" width = height "83" = "21" align = "right" alt = "wordmark2" / > < / h1 >
    < p > < / p >
    "" "< p > < img src ="file:///P|/RPS/AFMS/Quality Management System/QMS website/ENGLISH SITE/assets/AFM QMS features "width ="709"height ="80"alt ="banner"border ="0"/ > < a href ="mailto:[email protected] "" > < img src = "file:///P|/RPS/AFMS/Quality Management System/QMS website/ENGLISH SITE/Assets/Contactus-e.JPG" width = "110" height = "21" alt = 'contactus-e' border = '0' "/ > < /a > < img src ="file:///P|/RPS/AFMS/Quality Management System/QMS website/ENGLISH/elements of " "" SITE / French - e.JPG "width ="115"height ="21"alt = 'french-e' border = '0' / > < a href ="file:///P|/RPS/AFMS/Quality Management System/QMS website/ENGLISH SITE/ContinualImprovement - e.html "" > < img src = "file:///P|/RPS/AFMS/Quality Management System/QMS website/ENGLISH SITE/Assets/Help-e.JPG" width = "115" height = alt '21' = 'help-e' border = '0' "/ > < img src ="file:///P|/RPS/AFMS/Quality Management System/QMS website/ENGLISH SITE/Assets/Search-e.JPG "width ="115"height ="21"alt = 'search-e' border = '0' / > < /a >" "< a href ="http://source.tpsgc-pwgsc.gc.ca "" > < img src = 'file:///P|/RPS/AFMS/Quality Management System/QMS website/ENGLISH SITE/Assets/thesource.jpg "width ="120"height ="21"alt ="TheSource"border = '0'" / > < img src = "file:///P|/RPS/AFMS/Quality Management System/QMS website/ENGLISH SITE/Assets/Home-e.jpg" width = "104" height = "21" alt = 'Host-e' border = '0' / > < /a > < /p > "
    < p > < / p >
    < / div >
    <! - TemplateEndEditable - >
    < div class = "twoColElsLtHdr" id = "sidebar1″" >
    "" < p > < a href = "... / HOME QMS/QMSHome - e.html" > < strong > home QMS < facilities > < /a > < /p >
    < hr / >
    "" < p > < a href = "... /ABOUTAFM/AboutAFM-e.html" > < strong > on AFM < facilities > < /a > < /p >
    < hr / >
    "" < p > < a href = "... /AdminProcedures/AdminProcedure-e.html" > < of strong administrative procedures > < / strong > < /a > < /p >
    < hr / >
    "" < p > < a href = "... /BusinessUnits/BusinessUnits-e.html" > < strong > < /a > < /p > < facilities > business units
    < hr / >
    "" < p > < a href = "... /POINTSOFINTEREST/pointsofinterest-e.html" > < strong > < facilities > < /a > < /p > Points of interest
    < hr / >
    "" < p > < a href = "... /Achievements/Achievements-e.html" > < strong achievements > < / strong > < /a > < /p >
    < hr / >
    "" < p > < strong > < a href = "... /MeasuringPerformance/measuringperformance-e.html" > measuring Performance < /a > < / strong > < / p >
    < hr / >
    "" < p > < a href = "... /References/References-e.html" > < strong references > < / strong > < /a > < /p >
    < hr / >
    "< p > < a href ="file:///P|/RPS/AFMS/Quality Management System/QMS website/ENGLISH SITE/ContinualImprovement - e.html "> < continuous improvement strong > < / strong > < /a > < /p >"
    < hr / >
    Corners of strong regions > < p > < < / strong > < / p >
    < / div >
    <!-TemplateBeginEditable name = 'Body'->
    < div id = "mainContent" >
    Header < h2 > < / h2 >
    Paragraph < p > < /p >
    Sub header < h1 > < / h1 >
    < p > < / p >
    < h1 > < / h1 >
    < h2 > < / h2 >
    < h1 > < / h1 >
    < p > < / p >
    < h2 > < / h2 >
    <!-end #mainContent->
    < / div >
    <! - TemplateEndEditable - > <!-this element of compensation should immediately follow the #mainContent div in order to force the #container div to contain all the child-> fleet

    < br class = 'clearfloat' / >
    < /p >
    <!-TemplateBeginEditable name = "Footer"->
    < div id = "footer" >
    < hr width = "100%" size = "8" noshade "noshade" color = "#006666" id = = "color = & quot; 069 & quot; "color ="#069"/ >
    < p > < strong > followed by: ASQM < facilities > < / p >
    < p > < strong > updated: 25-03-2013 < facilities > < / p >
    <!-end #footer->
    < / div >
    <! - TemplateEndEditable - > < script type = "text/javascript" >
    <!--

    ->
    < /script >
    < / h3 >
    <!-end #container->
    < / h3 >
    < / div >
    < script type = "text/javascript" >
    <!--

    ->
    < /script >
    < / body >
    < / html >

    Make sure you have editable regions in the body of your template set properly before you start it. Also, make sure that you have made a backup copy of your current site (copy the ROOT folder and paste it somewhere on your disk).

    OK - Here's what you need to do:

    0 make a backup of your current website (copy the ROOT folder and paste it somewhere on your disk).

    1. create a new page in your current template (file > New > Site templates > (Site) > (model selection) > Create.) Make sure the checkbox "Update Page when the template is changed" is checked.

    2. thanks to this new page open, open page 1 of 51 pages and copy and paste the contents of each editable area of page 1 in the same area can be changed to your new page.

    3. close page 1.

    4. save the new page with the name of the page of 1 so that the old page 1 is replaced by a new one.

    5. Repeat this operation for all 51 pages.

    Sorry, it's so tedious, but in the end, you will once more a fully controlled model site.

    Moreover, before leaving page 1 and the graphs closing this file, please post here any questions you may have.

  • Script will not apply the paragraph style

    Hello

    I'm new to scripting in InDesign (CS3), and I'm trying to understand why the scipt below does not apply a style in the following text file? :

    < ASCII-WIN >

    < ParaStyle: Heading 1 > who are we? < ParaStyle >:

    For ease of reading, I have shortend the text file to just two lines.

    The script that I use to open and to format the text file is:

    Create a new document.

    myDocument var = app.documents.add ();

    Set the units of measure and the origin of the rule.

    myDocument.viewPreferences.horizontalMeasurementUnits = MeasurementUnits.points;

    myDocument.viewPreferences.verticalMeasurementUnits = MeasurementUnits.points;

    myDocument.viewPreferences.rulerOrigin = RulerOrigin.pageOrigin;

    Get a reference to the first master spread.

    var myMasterSpread = myDocument.masterSpreads.item (0);

    Get a reference to preferences on the margins of the first page in the Master spread.

    var myMarginPreferences = myMasterSpread.pages.item (0) .marginPreferences;

    Now set up the page margins and columns.

    myMarginPreferences.left = 4;

    myMarginPreferences.top = 70;

    myMarginPreferences.right = 70;

    myMarginPreferences.bottom = 78;

    myMarginPreferences.columnCount = 2;

    myMarginPreferences.columnGutter = 14;

    The margins of page and columns for the right-hand page.

    var myMarginPreferences = myMasterSpread.pages.item (1) .marginPreferences;

    myMarginPreferences.left = 48;

    myMarginPreferences.top = 70;

    myMarginPreferences.right = 70;

    myMarginPreferences.bottom = 78;

    myMarginPreferences.columnCount = 3;

    myMarginPreferences.columnGutter = 14;

    Adding Master Page items

    var myMasterSpread = myDocument.masterSpreads.item (0);

    var myLeftPage = myMasterSpread.pages.item (0);

    var myRightPage = myMasterSpread.pages.item (1);

    var myLeftFooter = myLeftPage.textFrames.add ();

    myLeftFooter.geometricBounds = [70, 742, 728, 528];

    myLeftFooter.textFramePreferences.firstBaselineOffset = FirstBaseline.leadingOffset;

    myLeftFooter.contents = SpecialCharacters.autoPageNumber;

    myLeftFooter.parentStory.characters.item (0) .pointSize = 11;

    myLeftFooter.parentStory.characters.item (0) .leading = 14;

    var myRightFooter = myRightPage.textFrames.add ();

    myRightFooter.geometricBounds = [48, 742, 728, 542];

    myRightFooter.textFramePreferences.firstBaselineOffset = FirstBaseline.leadingOffset;

    myRightFooter.contents = SpecialCharacters.autoPageNumber;

    myRightFooter.parentStory.characters.item (0) .pointSize = 11;

    myRightFooter.parentStory.characters.item (0) .leading = 14;

    myRightFooter.parentStory.characters.item (0) .justification = Justification.rightAlign;

    Adding master text frames

    var myLeftPage = myMasterSpread.pages.item (0);

    var myRightPage = myMasterSpread.pages.item (1);

    var myLeftTextFrame = myLeftPage.textFrames.add ();

    myLeftTextFrame.geometricBounds = [70, 70, 714, 528];

    myLeftTextFrame.textFramePreferences.firstBaselineOffset = FirstBaseline.leadingOffset;

    myLeftTextFrame.textFramePreferences.textColumnCount = 3;

    myLeftTextFrame.textFramePreferences.textColumnGutter = 14;

    Add a label to make the image easier to find later.

    myLeftTextFrame.label = "BodyTextFrame";

    var myRightTextFrame = myRightPage.textFrames.add ();

    myRightTextFrame.geometricBounds = [70, 48, 714, 542];

    myRightTextFrame.textFramePreferences.firstBaselineOffset = FirstBaseline.leadingOffset;

    myRightTextFrame.textFramePreferences.textColumnCount = 3;

    myRightTextFrame.textFramePreferences.textColumnGutter = 14;

    Add a label to make the image easier to find later.

    myRightTextFrame.label = "BodyTextFrame";

    Link the two frames using the nextTextFrame property.

    myLeftTextFrame.nextTextFrame = myRightTextFrame;

    The substitution of Master Page points and adds text

    var myTextFrame = myDocument.masterSpreads.item (0).pages.item (1).textFrames.item (0) .override (myDocument.pag es.item (0));

    Add text by setting the contents of the insertion of a string.

    In JavaScript, "\r" is a return character.

    .silence myTextFrame.insertionPoints.item (0) = "dok\r";

    Adding and applying a paragraph Style

    var myParagraphStyle = myDocument.paragraphStyles.item ("title 1");

    try {}

    var myName = myParagraphStyle.name;

    }

    {} catch (MonErreur)

    //The style of paragraph don't have not exist, so create it.

    myParagraphStyle = myDocument.paragraphStyles.add ({name: 'Title 1'});

    }

    We need to create a color. Check if the color already exists.

    myColor var = myDocument.colors.item ("Green");

    try {}

    myName = myColor.name;

    }

    {} catch (MonErreur)

    //The color have not exist, so create it.

    myColor = myDocument.colors.add ({name: 'Green', model: ColorModel.process, colorValue:[100,0,100,0]});})

    }

    Now set the formatting of the paragraph style.

    myParagraphStyle.appliedFont = "Arial";

    myParagraphStyle.fontStyle = "Bold";

    myParagraphStyle.pointSize = 24;

    myParagraphStyle.spaceAfter = 24;

    myParagraphStyle.spaceBefore = 24;

    myParagraphStyle.fillColor = myDocument.colors.item ("Green");

    Apply the style to the paragraph.

    myDocument.pages.item (0).textFrames.item (0).paragraphs.item (0) .applyParagraphStyle (myParag raphStyle, true);

    You can also use:

    myDocument.pages.item (0).textFrames.item (0).paragraphs.item (0) .appliedParagraphStyle = //myParagraphStyle;

    Import a text file

    Display a standard dialog box open the file to select a text file.

    var monFichierTexte is File.openDialog ("choose a text file");.

    If you selected a text file, and if you didn't press Cancel,

    Place the file of text on the first insertion point after the title.

    If ((monFichierTexte! = "") & & (monFichierTexte!) (= null)) {}

    myTextFrame.insertionPoints.item(-1).place (myTextFile);

    }

    Place a graphic

    Display a standard dialog box open the file to select a graphic file.

    var myGraphicFile is File.openDialog ("choose a graphic file");.

    If you have selected a graphics file, and if you didn't press Cancel,

    Place the graphic file on the page.

    If ((myGraphicFile! = "") & & (myGraphicFile!) (= null)) {}

    var myGraphic = myDocument.pages.item (0) .place (myGraphicFile);

    //Since you can place multiple graphics at once, the place method

    //returns a table. For the graph you have placed, get the first

    //item in the table (beginning of JavaScript arrays with element 0).

    myGraphic = myGraphic [0];

    //Create a style object to apply to the graphic image.

    var myObjectStyle = myDocument.objectStyles.item("GraphicFrame");

    try {

    var myName = myObjectStyle.name;

    }

    catch (MonErreur) {}

    //The an object style have not exist, so create it.

    myObjectStyle = myDocument.objectStyles.add({name:"GraphicFrame"});)

    }

    myObjectStyle.enableStroke = true;

    myObjectStyle.strokeWeight = 3;

    myObjectStyle.strokeType = myDocument.strokeStyles.item("Solid");

    myObjectStyle.strokeColor = myDocument.colors.item("Green");

    //The frame containing the graphic is the parent of the graphic.

    myFrame var = myGraphic.parent;

    myFrame.applyObjectStyle (myObjectStyle, true);

    //Resize the frame to a specific size.

    myFrame.geometricBounds = [0,0,600,600];

    //Fit the graph in the image proportionally.

    myFrame.fit (FitOptions.proportionally);

    / / Next, mount the frame to the resized image.

    myFrame.fit (FitOptions.frameToContent);

    var myBounds = myFrame.geometricBounds;

    var myGraphicWidth = myBounds [3] - myBounds [1];

    //Move the graphic frame.

    var myPageWidth = myDocument.documentPreferences.pageWidth;

    var myTopMargin = myDocument.pages.item (0).marginPreferences.top;

    myFrame.move ([myPageWidth-myGraphicWidth, myTopMargin]);

    //Apply a wrap to the graphic frame.

    myFrame.textWrapPreferences.textWrapType = TextWrapTypes.boundingBoxTextWrap;

    myFrame.textWrapPreferences.textWrapOffset = [12, 24, 12, 24].

    }

    I hope someone can point me in the right direction.
    Thanks in advance.
    Ron

    Hey, Ron.

    The problem has nothing to do with your script. You can see if you attempt to place the file from indesign tagged text by hand.

    Your instinct for divide and conquer for debugging is a good - have a short text file to work with is very useful - of course this is also true for the script.

    During the validation of the scripts on the forum, please do not use the syntax insert > feature Java which lies behind the > arrow in the toolbar. Otherwise, cut and paste your script are difficult requiring manual corrections.

    Anyway, your problem is that each paragraph can have only a single paragraph style, and it's the last one that you define.

    So in your IDTT file, you set the heading 1 paragraph style, enter the content of the paragraph and then set the style of paragraph votes to zero.

    If you have included a line break before setting the style of paragraph votes to zero, you must set the None style for the following paragraph. But since you have not, it resets just the style to the current paragraph.

    In short: success back before .

  • (JS) How to apply the existing paragraph styles to text in a textFrame

    @I have a definition called "Header" in my Document.

    How to apply this paragraph style "Header" textFrame selected with the text "This is my head" using JS

    Please advise...

    Thank you..

    @I have a definition called "Header" in my Document.

    How to apply this paragraph style "Header" in textFrame selected with the text "This is my head" using JS

    as directed by your initial thread in question that asked you to change only the text block selected, so I gave code such as

    myDoc1 = app.selection [0];

    but myDoc1 = app.activeDocument; lets you apply the styleforwholedocument

    FYI

  • 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.

  • How to use GREP to apply the character style just for the first and the second line of the paragraph?

    as the title, I just want to ask how to apply the style of character just for the 1st and 2nd line of the paragraph. Help me pls, tks!

    Can you show the screen shot with the invisible market, looks like you feedback after each line.

    So, something like this would work where I have a return forced for the linebreak (shift + return). The example on the right does not work because the line break is a return:

  • retention of the words italic when you apply the paragraph style

    When you place text in InDesign, I want to apply a paragraph style, but keep some (foreign) words in italics without having to search for each word and apply the italic character style. Texts are long and not originated by myself.

    The most recommended book for beginners here on the forum is Visual QuickStart of Sandee Cohen for InDesign. The 'bible' in my opinion, for very advanced users is Real World InDesign.

  • Apply the table style based on the contents of the cell

    I'm on a Mac, OS 10.8.5 using InDesign 5.

    Does anyone know how to apply a table style based on the content of text found in a cell in javascript?

    I need to find the document and change all the styles table 'LONG orange verbatim' If the text "HS:" appear in the header line.

    I've been playing with scripts found with the following 3 wires, but can get it to apply a table style.

    Thank you!

    Apply Table Cell Style based on text search and How to apply a cell of table based on grep style search? and Re: find PStyle and apply the cell Style in the Table

    Here are the corrected lines:

    var curDoc = app.activeDocument;
    var allTables = curDoc.stories.everyItem().tables.everyItem(); 
    
    app.findTextPreferences = app.changeTextPreferences = null;
    app.findTextPreferences.findWhat = "HS:";
    var allFounds = allTables.findText();
    app.findTextPreferences = app.changeTextPreferences = null;
    
    for ( var i = 0; i < allFounds.length; i++ ) {
        var curFound = allFounds[i];
        if ( curFound.length == 1 ) {
            var curFoundParent = curFound[0].parent;
            if ( curFoundParent.parentRow.rowType == RowTypes.headerRow ) {
                curFoundParent.parent.appliedTableStyle = curDoc.tableStyles.itemByName( "verbatim orange LONG" );
            }
        }
    }
    
  • How to create and apply a condition to the selected text?

    Hi all

    I am new to Scripting InDesign. I use Flex 4.6, so I use ActionScript. I want to apply the conditional text in some text selected in my document. I understand the process manually. But I'm problem do it programmatically.

    I see that there is a Condition class. I created an object of this class and tried to set some values.

    var nameCondition = new Condition();

    nameCondition.indicatorMethod = ConditionIndicatorMethod.USE_UNDERLINE;

    nameCondition.label = "name";  Could not understand what label is synonymous with

    nameCondition.name = "name";

    nameCondition.visible = false;

    Now, when I debug, I see that the values that I have assigned to the object nameCondition are never affected.

    Also, I came across the appliedConditions method that is available in the app and doc. But I don't know how to use it.

    Help, please.

    Hi poortip87,

    Find the code JS, his work below InDesign CS5.5 only.

    var myDoc = app.activeDocument;
    try{
        myDoc.conditions.add({name:"TEST", indicatorColor:UIColors.GOLD, indicatorMethod:ConditionIndicatorMethod.USE_HIGHLIGHT, visible:false})
        }catch(e){}
    
    app.selection[0].applyConditions(myDoc.conditions.itemByName("TEST"));
    

    THX,

    csm_phil

Maybe you are looking for

  • Curious to know if I can trade in my 6s for the new smaller 5se?

    I've recently upgraded to a 6 s iPhone 64 GB from my old 4. I wonder if there is a method for me to trade in my 6 new s relative to the 5se announced today. Sounds similar in structure/performance and I did a little "like the smaller footprint... Tom

  • hislip discovered

    Hey,. I'm planing to make my device to HiSLIP. HiSLIP devices will be auto-discovery by "VISA find resource '? And where are the specifications for the discovery algorithm... for giving me the chance to implement "side Server? I can not find the spec

  • Photosmart 5520 transforms the unique items in several separate files when scanning to the imac

    My 5520 when scanning for my imac (on OSX10.6.8) wireless began to separate a page I'm scanning in several separate files that contain certain words or images, but not all of the content. I have reset to factory settings, but the problem remains the

  • "Error 0x400110020000100A if this problem persists, contact HP support.

    I bought the system of HP recovery disks for my Pavilion dr9225nr and bought a new HDD on their request, because my first attempt to install the recovery image has ended up with the same error code. So I now have a new hard drive HP supplied recovery

  • Power On seeing yellow short as system boot

    Possible pending the outcome of material: System: -Dell Dimension 4600i Mini-Tower OEM from 2004, BIOS has been improved version available to the most recent A7, A12.-P4 2.8 non-hyper, 2 GB RAM, nvidia 6200 PCI, Creative Sound Blaster Live! Series (W