find style paragraphs and it should be placed as marginal notes...

Hi everone,

We have the script to find paragraphs by his style and cut these paragraphs in the main column of the page and paste it into the new block of text and it will be placed as marginal notes. After putting the first marginal note, the script displays error as "Reference could not be found." Also, we have this marginal notes as anchor text. Find the script below and suggest me,

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

myDocument var = app.activeDocument;

myDocument.viewPreferences.rulerOrigin = RulerOrigin.pageOrigin;

myDocument.viewPreferences.horizontalMeasurementUnits = MeasurementUnits.points;

myDocument.viewPreferences.verticalMeasurementUnits = MeasurementUnits.points;

myDocument.zeroPoint = new Array (0, 0);

MyPage = app.layoutWindows var [0].activePage.side;

var mypage2 = app.layoutWindows [0].activePage.name;

orientation of the var;

If (mypage is 1919382632)

direction = "Right";

on the other

direction = "Left";

try {}

mySelection var = null;

mySelection var = myDocument.selection [0];

If (mySelection == null) {}

alert ("select any block of text, then run it);

exit (0) ;}

myDocument.textFramePreferences.textColumnCount = 1;

for (i = 0; i < mySelection.paragraphs.length; i ++)

{

if (mySelection.paragraphs [i].appliedParagraphStyle.name == "M-Term")

      {

            var a = i + 1;

mySelection.paragraphs [i] .select (SelectionOptions.replaceWith);

while (mySelection.paragraphs [a].appliedParagraphStyle.name == "M - Def") {}

mySelection.paragraphs [a] .select (SelectionOptions.addTo);

                        a++;}

            app.cut ();

if (direction == "Left")

var myframe = myDocument.pages.item (mypage2).textFrames.add ({visibleBounds: ["120 pt", "pt 42", "pt 190", "pt 156"], table of contents: "S"});

            else

myframe var = myDocument.pages.item (mypage2).textFrames.add ({visibleBounds: ["350 pt", "457 pt", "438 pt", "571 pt"], table of contents: "S"});

myframe.paragraphs [0] .select (SelectionOptions.replaceWith);

app.paste ();

myframe.fit (FitOptions.frameToContent);

      }

      }

{catch (e) {alert (e) ;}

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

Can someone help me with this.

Thanks in advance...

Indana

> all placed paragraphs are by default for the standard paragraph style and these paragraphs are losing its style as a paragraph style formats, but also the style of character. Style formats are not preserved as the same.

This is because when you do

myText.contents = myFind [i] .silence;

you copy all the contents of text, none of the setting in the form. To get the items found as well as their blowdry, try something like this instead:

myFind [i] .move (LocationOptions.after, myText.insertionPoints [0]);

Of course, then you must remove the line myFind [i] .remove (); because there is nothing to move.

Peter

Tags: InDesign

Similar Questions

  • Where can I find the vertical and horizontal spaces of you or margins on CC Version?.

    Where can I find the vertical and horizontal spaces of you or margins on the CC Version? I need to leave a few spaces pixels around an image, but I can't find it on this new version.

    Thanks in advance

    In the CSS designer under window > CSS designer or SHIFT + F11

    Choose the item that you are working with and press on the + in the selectors of section

    Then in the Properties section, make sure that the first tab is selected (Layout) and scroll down to the margin

    Set it to a number of pixels that you want (for example, 10px)

  • CS3: need script to replace spaces with underscores in the paragraph and character style names

    Help! I am very new to scripting.

    I managed to find and tweak existing javascripts to search through all my paragraph styles to disable hyphenation and off balance the jagged lines, but I need help with this one.

    I work on Mac OS 10.4.11 using Indesign CS3.

    I need a script that will search all my paragraph and character styles in my open Active document and replace spaces by underscores.

    Can someone help me with this? It would be greatly appreciated!

    1. I don't know, but I think you can use all the regular GREP inside this function codes. Do not use the quotation marks around of the expression, use slashes! (Why? Just a curiosity of Javascript... maybe a hack that goes back to the gray mist of JS development...)

    This work should - but rather the code above, this is not tested:

    .. Replace (/ [-\ / ()-. _] + / g. '_');

    The GOLD group inbetween the brackets contain all the characters you want to replace with an underscore: the hyphen (this has to be the first character in the group, else it will be interpreted as a range of characters from each side!), space, slash (this one is 'special' inside the function replace JavaScript, so I think he needs to escape with a backslash)! in parentheses, a period (not sure if it should escape - into ordinary GREP, it's the wildcard character for any character, but maybe he loses his magic within a group of GOLD) and finally... the underscore character. Why?

    Well, this replacement string comes with a free bonus. Note the sign after the installment of GOLD +. This means that a whole sequence of these characters is replaced by a simple underscore: "it's / a - / test" will become "This_is_a_test". Adding the underscore line itself to the string of research means that it will also find the whole chain 'space space (stroke underscore)' in 'This style (_)' and, oh magic!, replace it immediately with a single underscore.

    Just FYI, the tiny "g" after the closing slash is abbreviation of 'global', i.e. at the global level, replacing in this string. replace the default values for a replacement only (why? see above...), and adding the 'g' ensures he keeps replacing until it is not find matches more.

    2 see point 1.

    3. uh, yes it's true, but you will need to check very carefully if nothing inside one of these basic models is substituted. You can apply a base style and add substitutions to make look like a subtitle, but that isn't making it a. And to the next paragraph, you can apply a base style and add substitutions to make it look like a paragraph of plain text (etc.). It's a signature of witness to bad formatting...

  • [JS InDesign CS3] Style groups, Caprice in colors! (or: how to make the styles of paragraph and character off groups style?)

    Sorry for this question (and my terrible English, incidentally), I'm a javascript noob and I know when I reached my limits.

    Well, I'm taking a set of paragraph and character style groups styles, they are placed in hundreds of InDesign documents (which cannot be regarded as a book). As much as I've tried (thanks to the invaluable help of previous messages in this forum), I was able to move a style to a group and change its position within the group, inside root-level, or between the groups. But it is not matter how I try, I don't know which move reference should I try in case I want to take each style outside the style group and place them after their original level group, folder style [Root].

    I tried:

    var doc=app.activeDocument;
    var pGroups=doc.paragraphStyleGroups;
    
    for (i=pGroups.length-1; i>=0; i--){
         var pStylesInGroup=pGroups[i].paragraphStyles;
         for (j=pStylesInGroup.length-1; j>=0; j--){
    // Here I am, trying to move a style outside the folder that contains it, and failing miserably.
              pStylesInGroup[j].move (LocationOptions.after, pGroups[i]);
         }
    }
    

    He did not, the script has sent an invalid parameter value in the reference field, so I can't use the folder of the group itself as reference.

    Tried (obviously false) alternatives, such as the first available style using as reference. So my second script was

    var doc=app.activeDocument;
    var pStyles=doc.allParagraphStyles;
    var pGroups=doc.paragraphStyleGroups;
    
    for (i=pGroups.length-1; i>=0; i--){
         var pStylesInGroup=pGroups[i].paragraphStyles;
         for (j=pStylesInGroup.length-1; j>=0; j--){
    // Now I try placing the styles after the [Basic Paragraph], that is, the second paragraph style in the document style list 
              pStylesInGroup[j].move (LocationOptions.after, pStyles[1]);
         }
    }
    
    

    It did not work either, another invalid parameter in the reference field. Similar results with my other attempts (I even tried "[Root]" as literal with similar luck).

    So my question is: what command (or script, in case my approach is quite wrong) should I use to accomplish my goal?

    Thanks in advance to those who decide to spend more than a minute thinking about my humble worries and my apologies for some of your lines of code Ripper shamelessly for my purposes.

    Well, tried a few things and I really weird results!

    1. you can move a style within its group.

    2. you can move a style to one group "to" the other, but it will appear "inside" of this style. I got my style of test as a subdivision of [standard paragraph], using index #1. By the index 0 # InDesign ([no paragraph Style]) crashed.

    3. you can duplicate the style, but then you get a copy of the same group. Still no luck.

    4 finally! What is the parent of a paragraph style?

    Document | Request | ParagraphStyleGroup

    'Application' is easy - it's when you do a global style. So, what's the difference between 'Document' and 'paragraphStyleGroup '? Single - well, when you get finally he...

    pStylesInGroup[j].move (LocationOptions.AT_END, doc);
    

    move the style out of the Group and at the end of the list in the document. I don't think it's possible to move directly to a specific position in the main style list - you first need to move a group, then move it around in its own list.

    Fortunately, he returns his new position as a definition once again, if necessary, you can use

    newStyle = pStylesInGroup[j].move (LocationOptions.AT_END, doc);
    newStyle.move (LocationOptions.AFTER, pStyles[1]);
    

    -I haven't really tried this possibility, but it should work.

  • Synchronization of the paragraph and character creative cloud styles

    Is it possible to add several styles of paragraph and character of a library of clouds to a doc ID? I can't find a way to add multiple styles at once, one at a time

    . Also, when you apply a style to the cloud, it gives me a name conflict, even if the 2 different styles have different names.

    These conflicts can come if you have styles based on another on and this is based on another, these styles are also imported and can cause conflicts.

  • Print descriptions of paragraph and character Style...

    InDesign: is it STILL possible to print the specifications of type through the character and paragraph Styles?

    You should not! Essential elements for a cool job!

  • InCopy paragraph and character styles

    Have been upgraded from CS3 to CS5 and our editors have a ton of paragraph and character style pré-séries. I was wondering if there was a way to import these to InCopy CS3 to InCopy CS5. I searched for them in the program files and the folder of application but data had no chance of finding.

    Open paragraph styles menu and choose load all styles. Find the file that has these defined styles.

    Bob

  • How can I find out what programs I should have started and what are the programs I can start myself to my computer to run correctly when starting?

    * Original title: startup

    How can I find out what programs I should have started and what are the programs I can start myself to my computer to run correctly when starting?

    Hello

    I understand you want to learn about programs, you should start your Windows startup. I will certainly help you to question.

    When you start Windows by using a normal startup startup, several applications and services automatically, and then run in the background. These programs include the base system, antivirus software, utility applications processes system and other software that was previously installed. These applications and services may cause interference when you install or run a program.

    The system configuration is a tool that can help identify problems that might prevent Windows from starting correctly. You can start Windows with common services and startup programs turned off and then reactivate them, one at a time.

    I suggest you to refer to the links below and check if this is useful:

    Using the Configuration System (msconfig)

    Perform a clean boot to determine if background programs interfere with your game or program

    Hope this information helps.

    Please get back to us with an update on the issue, we will be happy to help you.

  • Spacing and text Styles - paragraph are possible?

    First of all, can I change spacing of the paragraphs in Captivate 8? No line spacing, but the spacing of paragraphs. For example, 6 pt space after a paragraph as you can do in MS-Word.

    Second, 8 Captivate allows me to define text styles? I know I can set some styles for all objects such as the legends, but if I can define a style (for example MyTitle = Verdana 18pt "BOLD" or create 11pt Verdana plain = or MyEmphasis = 11pt Verdana italic red) and then apply to a text that I select an object of legend?

    Answer is doubly negative. Captivate is not as InDesign, its primary goal is e-Learning, to not publish or processing.

    There is no spacing of paragraphs, and I regret as much as you, only leading (line spacing).

    There are object styles only, no text style. Use a different (legend or form) text for the title, emphasis etc container and an appropriate object style. You can add attributes to individual words ("BOLD", false fat...) and the color as well. But that's all.

  • [JS] Copy or move the paragraph and character style style

    Hello
    I try to transfer paragraphs a the document to a block a second document but I have hugs the style of paragraph et style character applied.
    I use this command line:


    o.leBlocLegendes.contents = o.leBlocLegendes.contents + leDocument.stories.firstItem().paragraphs[leConteurPara].contents;
    
    


    How do I do not lose anything?

    Thank you


    Original message

    Hello

    I am trying to transfer of the paragraphs in a document to a block of a second document but I loses all the style of paragraph and style of applied character.

    Plug-in this command line:

    o.leBlocLegendes.contents = o.leBlocLegendes.contents + leDocument.stories.firstItem().paragraphs[leConteurPara].contents;
    

    Comment do pay nothing lose?

    Thank you

    Hi Liphou,

    .silence is indeed a property of type string only disregardingly of styles, anchor frames and other animals.

    You prefer the use of object methods and duplicate stories. However styles can be substituted with the target document. If you can load styles before the duplication of the text.

    var main = function() {
        var doc, st, tempDoc, f, tf;
        if (!app.documents.length
            || app.selection.length!=1
            || !app.selection[0].properties.parentStory) {
            alert("You need to select text or text frame");
            return;
        }
    
        doc = app.activeDocument;
    
        if ( !doc.properties.fullName ) {
            alert("Please save file first !");
            return;
        }
    
        st = app.selection[0].parentStory;
        f = File ( doc.fullName );
        tempDoc = app.documents.add();
        tempDoc. importStyles ( ImportFormat.TEXT_STYLES_FORMAT, f, GlobalClashResolutionStrategy.LOAD_ALL_WITH_OVERWRITE );
    
        tf = tempDoc.textFrames.add();
        st.duplicate(LocationOptions.AT_BEGINNING, tf.insertionPoints[0]);
        tf.fit(FitOptions.FRAME_TO_CONTENT);
    
    }
    
    main();
    

    HTH,

    Loïc

    www.ozalto.com

  • How to get all the style of paragraphs and their policies of an indesign file and write all the info with info para in a txt file with scripts

    @

    How to get everyone how to get all the style of paragraphs and their policies of an indesign file and write all the info with info para in a txt file with scriptingstyle and their policies of an indesign file and write all the info with info para in a txt file with scripts

    Hello

    Try this,

    var doc = app.activeDocument,
        pstyles = doc.allParagraphStyles,
        report = "";
    for(var i =0;i
    

    Kind regards

    Cognet

  • Apply OverprintFill option for all paragraph and character Styles

    Hello

    How can I request an OverprintFill option in all of paragraph and character styles in javascript. See my code below

    jsx. Coding: -.

    var mypstyle = app.documents.item (0).paragraphStyles.everyItem () .getElements ();

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

    {

    mypstyle [i] .overprintFill = true;

    }

    Alert ("Done")

    Just change the loop as below:

    var mypstyle = app.documents.item (0).paragraphStyles.everyItem () .getElements ();

    for (i = 1; i

    {

    mypstyle [i] .overprintFill = true;

    }

    Alert ("Done")

    Vandy

  • Issues with paragraph and CSS styles and models module Styles

    I am having difficulties with a text style in my templates module in British Colombia (especially the blog). The drop-down list in the Editor's paragraph style does not reflect the H1, H2, etc. that has been downloaded to the site at its inception in Muse. And I don't have the ability to use CSS styles.  What gives?

    How can I change the paragraph styles to match the downloaded versions that CSS is not available?

    http://sweetsandtreatsboutique.2121customcontact.com/index.html

    It may be somewhere in the Site Global stylesheet. My boss, who created it in Muse, labeled H1, etc. like the following...

    . H1-GaramondB-40-151

    {

    color: #543426;

    Police-family: Garamond, Hoefler Text, Palatino Linotype, Palatino, serif;

    font size: 35px;.

    make-weight: bold;

    line-height: 1;

    left margin: 0px;

    margin-right: 0px;

    padding-bottom: 0px;

    padding-top: 0px;

    }

    As a result, BC is not recognize this policy because of the name? I tried to delete the text after the .h1 and the paragraph style has not changed.

    -Chuck

    Hi Chuck,

    Your CSS code target the elements with the class ".h1-GaramondB-40-151", but this blog page your elments of a H2 does not have this category against them, that's why you need to replace the class name with the h2, as this element:

    H2 {}

    color: #543426;

    Police-family: Garamond, Hoefler Text, Palatino Linotype, Palatino, serif;

    font size: 35px;.

    make-weight: bold;

    line-height: 1;

    left margin: 0px;

    margin-right: 0px;

    padding-bottom: 0px;

    padding-top: 0px;

    }

    I hope that makes sense. If you are looking for something like 'target the elements on the page with CSS' you will see what I mean.

    See you soon,.

    Mario

  • Add a suffix to all of paragraph and character styles.

    As the title suggests, first of all I would like to add a suffix to all of paragraph and character styles:

    Title 1 = position 1_p

    Bold_p = "BOLD"

    Also, if possible, replace the space with an underscore:

    Title 1 = Heading_1_p

    Chapter No. 1 = Chapter_Heading 1_p

    You're not sure if this need of a script or two?

    Any help would be fantastic.

    See you soon

    Or use code below to replace all spaces with "_".

    For the paragraph Styles:

    myStyles = myDoc.paragraphStyles;

    for (oneStyle = 2; oneStyle)<>

    {

    myStyles [oneStyle] .name = myStyles [oneStyle].name.replace (/ / g, '_') + "_p";

    }

    For character Styles:

    var mycStyleslen = myDoc.characterStyles.length;

    for (a = 1;

    {

    myDoc.characterStyles [a] .name = myDoc.characterStyles [a].name.replace (/ / g, '_') + "_p";

    }

    Shonky

  • What happens if I don't use paragraph and character Styles?

    I was told that do not use character and paragraph styles makes the files 'unstable '. So everything we manually change is in danger to be changed apparently at random. I have worked in hundreds of InDesign files for several months and have never seen a problem where this is indeed the case. I did a quick search online and on these forums, but I've not found anything directly related to what will happen if the styles have been changed manually. So, what happens if you do not use character and paragraph styles?

    I don't see that there is nothing "unstable" do not use styles, but as mentioned, they make your life easier by providing a single place to make changes that affect all the text containing the tag with the style.

    An important feature/reason for the use of the character styles is that they take precedence over paragraph styles, if a particular word needs to be styled differently to surrounding text, bolded or italicized, for example, you can add a character style that modifies only the bold or italic style type. Subsequent changes to the paragraph style will affect the face and size, if these attributes are changed, but leave your word in bold or italics, bold or italic. If you use "local formatting" (select the word, and apply the formatting) you may lose when styles to change or remove overrides, which is probably the 'random change' you have heard.

    Peter

Maybe you are looking for

  • Connect the Direct 06 Koyo PLC to LabVIEW

    Please, help me. !!! I have can´t connecto Koyo PLC to LabVIEW with OPC, I can't find the tools for this PLC,

  • New keyboard or shift button available in Serbia?

    I am in Belgrade during the winter break and my Thinkpad has failed. My left shift key fell because pimples plastic on plastic (translucent/white) moving parts disappeared. This is the third mechanical failure on my current Thinkpad simply due to wea

  • CPU COOLER DELL XPS 8700

    What are the coolers possible cpu that you can install on the card mother dell xps 8700 motherboard without any editing fancy ghetto. As if it were a normal MOM?

  • Prevent students access the SSID with the school laptops

    Hi all I'm new to the network and I'm having a problem with the ACL.  My router is a RVS4000 that connects to a SG300.  The SG300 is in mode layer 3 and distributes to other sg300/200 that connect to multiple WAP321s. I have all configured for two VL

  • Rookie move BB JDE 5.0 beta 2 Simulator

    Hi all does anyone know a solution for this: Just installed the BB JDE 5.0 beta 2 and imported samples. When I then try to debug the example HelloWorld Simulator stops before the operating system is on the rise. In the debugger, I can see the followi