[JS] [CS5] case of finding a style of paragraph and to do something to the parentTextFrame

Hello

Be helped earlier with a loop through items looking for a fill color and then remove the objects are, I decided to try to reuse the loop for another purpose.

I'd like to loop through all stories in a document, find those who have a particular paragraph style applied to them and then 'out' use .parentTextFrame [0] to move the block containing text.

Here's what I have:

Main();

function Main() {}

var doc = app.activeDocument;

stories of var = doc.stories;

var STYLE = doc.paragraphStyles.item ("STYLE");

for (var i = stories.length - 1; i > = 0; i--) {}

If (.appliedParagraphStyle [i] stories == STYLE) stories [i] .parentTextFrames [0].move([3,5]);

}

}

The script is run, but the images do not move.

Change
" If (.appliedParagraphStyle stories [i] == STYLE) stories [i] .parentTextFrames [0].move([3,5]); »
TO
" If (.appliedParagraphStyle stories [i] == STYLE) stories [i] .remove (); »
Deletes the history.

I'm grateful for any help. Looks like it should work in theory, but obviously there is something wrong...

[You need: stories [i] .paragraphs [0] .parentTextFrames [0].move([3,5)];

or stories [i] .textContainers [0].move([3,5]);

Stories is not a property of parentTextFrames, so when JavaScript sees this, he thinks that you create a new property. I don't know why attempt to move it does not cause an error, but does not get errors when you think you should part of the JS experience.

Dave

Tags: InDesign

Similar Questions

  • My paragraph styles have disappeared and are now appearing as the character styles

    Working on a new site because my old site muse become buggy...

    and now, my paragraph styles have disappeared and are now appearing as the character styles

    Screen Shot 2015-10-13 at 5.07.55 PM.png

    Thank you for sending the files. One of the files does not contain any character or paragraph Styles. In the other, I see the character styles named as paragraph styles. All indications from within the file are that they were created as character styles. The file format includes indications of the type of the style as well on everything that they are applied and in the list displayed in the palette. All of these styles are indicated by styles of characters in both places. The attributes that are in the styles are limited to what is allowed in a character style.

    In some places where the styles are applied, they are applied to the blocks of text or widget and replacements parts for paragraph-level attributes (i.e. h1 tag, space before and after, etc.). This leads me to suspect that they have can be created from blocks of text pointer tool selections (or other elements of text in widgets) and it was perhaps accidental that they have created using character Styles where paragraph Styles Panel rather than the Panel?

  • 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

  • Find all Styles of paragraph "based on".

    I have a file with about 1 million styles to paragraphs, many of them unused.

    I want to delete some of them, but some of the models have been used as the basis for new models. Is there a way to find these other styles or break the connection?

    See here: http://forums.adobe.com/message/2030881#2030881

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

  • Apply to a Style object that defines the style of paragraph and 'paragraph style' to the text block with another block of text?

    I am trying to automate the application of styles in a brochure. Each image has a name, title, telephone, email, city... style paragraph.

    Can I apply an object style that instantly sets the styles of each paragraph. However if I have the linked text boxes, the style of the object does not seem to affect the block of text, or one of the text boxes. Is there a way to get around this?

    I just looked upward: this feature is limited to "simple, smooth text frames."

    I'm sorry.

  • Remove styles of paragraph and character (keep substitutions)

    Hello

    Trying to write a script that will delete all the points and character Styles that are also included in the groups and keep overrides.

    So far:

    //Remove paragraphStyles
    var docs = app.documents.everyItem().getElements();  
    var dl = docs.length;  
    while (dl--)   
        {  
            var parStl = docs[dl].paragraphStyles.everyItem().getElements();  
            var pl = parStl.length;  
            while (pl--) if (parStl[pl].name != "[Basic Paragraph]" && parStl[pl].name != "[No Paragraph Style]") parStl[pl].remove();  
         }
    
    
    //Remove characterStyles
    var chs1 = myDoc.characterStyles.length;    
        for(var j=chs1-1; j>0; j--)
        {    
          myDoc.characterStyles[j].remove();    
        }
    

    After you change the code snippet to remove groups:

    main();
    function main(){
        var targetDoc = app.activeDocument;
        removeAllTypeStyles (targetDoc);
    }
    
    function removeAllTypeStyles (targetDoc) {
        //remove all paragraph styles
        for (var ps = targetDoc.allParagraphStyles.length - 1; ps >= 0; ps--) {
            if (targetDoc.allParagraphStyles[ps].name != "[No Paragraph Style]" && targetDoc.allParagraphStyles[ps].name != "[Basic Paragraph]") {
                targetDoc.allParagraphStyles[ps].remove (targetDoc.paragraphStyles.itemByName ("[No Paragraph Style]"));
            }
        }
        //remove all character styles
        for (var cs = targetDoc.allCharacterStyles.length - 1; cs >= 0; cs--) {
            if (targetDoc.allCharacterStyles[cs].name != "[None]") {
                targetDoc.allCharacterStyles[cs].remove (targetDoc.characterStyles.itemByName ("[None]"));
            }
        }
        //remove all paragraph style groups
        for (var pg = targetDoc.paragraphStyleGroups.length - 1; pg >= 0; pg--) {
            targetDoc.paragraphStyleGroups[pg].remove ();
        }
        //remove all character style groups
        for (var cg = targetDoc.characterStyleGroups.length - 1; cg >= 0; cg--) {
            targetDoc.characterStyleGroups[cg].remove ();
        }
    }
    
  • Where can I find a list of the new styles of paragraphs 'improved '?

    I'm starting a new project, a book that will become an ebook. I want to start with the new Framemaker 12 Smart Catalog enhancements using a sample or document template.

    My problem? None of the models of book use the improved catalog. Models that do not use the improved catalgoue are thr reference, user manual and parts catalog card. If I use one of these templates, I'll have to do a lot of work to get rid of all the fancy formatting.

    Is there a place where I can get a full-ish paragraph tags names LIST?

    Thanks in advance.

    As far as I KNOW, he is there no master list. If you have 'Tools' Silicon Prairie utilities, you can compile your own lists. See: Silicon Prairie - produced FrameMaker

    The best approach is to use just the special copy to pick up the styles of paragraph and character you want to Add to your new template, and build the fragmented model, i.e. create a FM for your tables, another for your page/sizes page layouts, one for your labels, cross-references, etc. Then combine those required to build the final model. This Lego approach is much more flexible and allows you to change the basic components and quickly make a new new model.

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

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

  • several styles of paragraph created in 1 doc, but I don't see them in the next doc

    These two documents are chapters in a book.


    They both have been added to the book using the sign +.


    what I did is copy and paste a piece of text of Chapter 1 which retains the style of paragraph I want to use in the document 2.


    -the paragraph style is available.  (I have to be very careful to remove this well pasted text)

    -There must be a better way.


    any tips will be appreciated.

    Thanks again.

    You can either load the first file paragraph styles in the second in the paragraph Styles Panel, or to synchronize styles using the book panel.

  • Thousands of new Styles of paragraph in CS3

    I have a weird problem with InDesign CS3 has appeared lately: whenever I make a new document, certain Styles of paragraphs 20-60 addition spontaneously in the document. It would not be a big problem, but he has accumulated (the counter is now paragraph Style 4058) and each document is already about a minute to create.

    Has anyone had a similar problem, and what we could do about it?

    Thank you very much

    Ervin

    Do you mean what's happening with file > again and each time more new models are added, not define is not the same thing?

    This sounds like some sort of defective script related to the new command file, or perhaps for starting the application (look in the user scripts you and see if you have a folder named for the likely candidates startup scripts). Whatever it be added any open documents will become a default value for all new wor, so if there is a script added styles every time that the application starts, they would accumulate very quickly.

    I would also start InDesign, and without open docs select and remove all the unwanted styles and then close ID. Now replace your preferences: http://forums.adobe.com/thread/526990

  • Is it possible to find in which case is run in LabVIEW VI programmatically and display it...

    Is it possible to find in which case is run in LabVIEW VI programmatically and display it...

    I have published earlier the plugin Quick Drop here - https://decibel.ni.com/content/docs/DOC-38903#comment-36562 there is more information on how install or use it.

  • Where are find class style for ADF Mobile UI component?

    Hi all

    Mobile user interface component ADF have a built-in style call

    styleClass ="adfmf-commandButton-rounded "for the order

    My question is where to find such style calls

    No document No matter what link tutorial? and also how to apply my own css for these componet as I want to change

    icon for the command button (relode)?.

    Thank you

    Manish

    Just run Skinning Demo and you can find all different style classes.

    Oracle\Middleware\Oracle_Home\jdeveloper\jdev\extensions\oracle.maf\Samples\SkinningDemo

    Go through the section below dev guide and you will see all different style classes here:

    http://docs.Oracle.com/middleware/mobile200/mobile/develop/MAF-UI-components.htm

    You can search styleclass in the link above.

    Read this blog completely, and you will see how you can make a style for your command button:

    Deepak Jain blog: Oracle MAF counting

  • Now I have a new mac and me, I bought a previous CS5 - can´t find my product - even when I m connected... How? Why? I have my serial number, but when I try it fails...

    Now I have a new mac and me, I bought a previous CS5 - can´t find my product - even when I m connected... How? Why? I have my serial number, but when I try it fails...

    You do not have a serial number to download, so I think you're talking about installation AFTER downloading the file (s)

    CS6 and previous programs have not been tested and will not be updated to run on Mac El Capitan

    -which means you are trying to use CS6 and earlier at YOUR risk of having problems

    Maybe it's a fake because of Mac El Capitan and OLD programs error

    This information is a MUST to install old programs on Mac El Capitan

    -You can't get the same error message, but here are some links that CAN help with old programs

    Install CS5 on Mac 10.11 https://forums.adobe.com/thread/2003455 can help (also for others than CS5)

    -also a TEMPORARY security change https://forums.adobe.com/thread/2039319

    -http://mac-how-to.wonderhowto.com/how-to/open-third-party-apps-from-unidentified-developer s-mac-os-x-0158095 /

    -the guardian https://support.apple.com/en-au/HT202491

Maybe you are looking for