JS: Grep in the style names

Dear all,

Is there a way to gather and search under certain conditions paragraph styles? For example: paragraph Gather style names that start with the character 'H' in a table (as "H1", "H2", "Head", etc.).

Kindly let me know the coding basis for it.

Thanks in advance.

concerning

Lionel Messi

Hey!

It's really easy to get...

myDoc var = app.activeDocument;
var myStyles = myDoc.paragraphStyles;
var foundStyles = Array();
var searchString = String ("H"); You can enter more than one startng letter
var tempName = String();
for (i = 1; myStyles.length > i; i ++) {}
tempName = myStyles [i] .name;
If (tempName.substr (0, searchString.length) == searchString) {}
foundStyles.push (tempName);
}
}

List styles found
var nameList = String ("/");
for (i = 0; foundStyles.length > i; i ++) {}
nameList += [i] foundStyles + ' / ';.
}
Alert (NameList);

tomaxxi

Tags: InDesign

Similar Questions

  • Retrieves the paragraph formatting with style name

    All the

    kindly help me how to extract the name of definition with example.txt formatting:

    FOR EXAMPLE:

    Name of the style: "Body".

    Font = "15".

    head = "" 18"" "

    Aligh = "Left".

    etc...

    Concerning

    Hurix

    Change by Dave Saunders: something prevents the work answer button. I hope that this edition will reactivate it.

    Hi Hurix,

    Welcome.

    Please indicate the question as answered

    Add the properties you need by following the instructions in the 3rd line.

    Trevor

    // Export Specified Details of Documents ParagraphStyles By Trevor
    // http://forums.adobe.com/thread/1445961?tstart=0
    exportParagraphStyleDetails ("appliedFont pointSize spaceAfter spaceBefore"); // add property names separated by a space - The Style Name is included automatically
    // see http://jongware.mit.edu/idcs6js/pc_ParagraphStyle.html for a list of properties you can add
    
    function exportParagraphStyleDetails (props /* A string list of the desired properties */) {
        doc = app.activeDocument,
        ps = doc.paragraphStyles.everyItem().getElements().slice(0),
        l = ps.length,
        c = 0;
        props = props.replace(/\s+/g, " ").split(" ");
        pl = props.length;
            var styleDetails = [];
        while (l--) {
            var  myStyle = ps[l];
            styleDetails[c++] = "******************************************************************\rParagraph Style Name: " + myStyle.name + "\r******************************************************************"
            for (var n = 0; n < pl; n++) {
                styleDetails[c] = props[n] + ": " + myStyle[props[n]].toString();
                if (myStyle[props[n]].hasOwnProperty ("name")) styleDetails[c] = styleDetails[c].replace (/:.+/, ".name: " + myStyle[props[n]].name);
                c++;
            }
        styleDetails[c++] = "\r";
        }
    
        temp = new File (Folder (Folder.temp) + "/" + doc.name + " Paragraph Style Properties " + ("" + new Date).replace(/:/g,"\xB7").replace(/G\S+$/,"")+ ".txt");
        temp.encoding = "UTF-8";
        temp.lineFeed = ($.os[0]=="M") ? "Macintosh" :" Windows";
        temp.open('w');
        temp.write("\uFEFF" + styleDetails.join("\r"));
        temp.close();
        $.sleep(300);
        temp.execute();
    }
    
  • How to use the style grep for "BOLD" of specific characters in a name?

    Hello world

    I use InDesign CS6. The name of our company is Careington. We need to "BOLD" care in careington. I was doing this manually before I learned about grep styles. So I created a character "BOLD" style, then I created a style of grep with the following:

    Apply the Style: "BOLD"

    Text: Car [eington] / not mistyped.

    I tried care [ington], but he did only this eington of the car, so I had to type car [eington] to get this careington. I still don't understand why this is happening.

    Now it works as [eington], but for some reason, every time care is in itself or used anywhere (health care, care, etc.), it is "BOLD" as well. Not when he's in chargeington.

    Any ideas on how I can work this formula is more specific and unique "BOLD" care when he's with "ington.

    Thanks, Mike

    Appy Style "BOLD"

    text: Care(?=ington)

    It worked when I tested it

  • How can I add a style "BOLD" grep on the first occurrence of a Word?

    Hi all

    I need help on adding a style "BOLD" grep on the first occurrence of a Word.

    I can add the "BOLD" to the word, but it adds to all occurrences, see below:

    GREP style (Incorrect)

    Apply Style: "BOLD"

    Text: \ < Lorem Ipsum\ >

    Nam Lorem Ipsum semper pellentesque tincidunt. UT nisi sit amet arcu nulla tristique dictum. SED commodo total non mauris cursus pretium. Lorem Ipsum Aliquam erat volutpat. Morbi id pretium justo. Nam lorem quis facilisis molestie risus fermentum. Vestibule ut sem elit. Nunc eget neque Sed elementum augue EU outbound.

    I need only the "BOLD" to add to the first occurrence of the word, as below:

    Nam Lorem Ipsum semper pellentesque tincidunt. UT nisi sit amet arcu nulla tristique dictum. SED commodo total non mauris cursus pretium. Lorem Ipsum Aliquam erat volutpat. Morbi id pretium justo. Nam lorem quis facilisis molestie risus fermentum. Vestibule ut sem elit. Nunc eget neque Sed elementum augue EU outbound.


    Thanks in advance for the help!

    This should do it for you

    Apply style

    "BOLD"

    text (? i) ^(.+?) Lorem Ipsum

    apply the stye

    Book

    text: ^. * ? (? = Lorem Ipsum)

    The first expression search all the text from the beginning of the parapgrah through the Lorem Ipsum

    The other defines the rest of the text before the Lorem Ipsum to the base style (book, novel, or whatever your basic style)

  • remove the grep in paragraph styles

    Hello

    I added grep styles to my para styles:

    for (var i = 1; i < myParaStyles.length; i ++) {}

    var myGrepStyles is myParaStyles [i].nestedGrepStyles.add ();.

    myGrepStyles.grepExpression = '. '. (?=»)";

    myGrepStyles.appliedCharacterStyle = myDoc.characterStyles.itemByName ("Stylename");

    }

    in a new version, I have to get rid of these grep styles. Replacing the stylename with "[None]" does not, and removing the style isn't a solution either, as it could is used somewhere else.

    any ideas?

    Thanx

    You can remove GREP styles:

    myParagraphStyle.nestedGrepStyles [0] .remove ();

    If there are two or more GREP styles in a paragraph style, loop through them.

    Peter

  • The combination of files with the same style name, different styles

    I'm writing a book and I saved every chapter in a separate file. I will now copy all of the pages in a single big file, basically. The problem is - and I would have thought about this before, I have used the same style names in each chapter, but made some settings for styles in the last chapters I want to apply to the previous chapters. If I combine these files in a new file, how can I make sure that the later styles are those that is used (IE, overwrite the previous styles with the same name). In other words, can I specify a 'master' style that overrides all "local" styles that are imported from a specific file (I'm not sure I used the master and local correctly, but I hope you know what I mean.)

    Also, just out of curiosity, if I wanted to keep these two styles that had the same name, is there a way to do it, too?

    Thanks in advance for any help!

    You prepare a book, use an Indesign 'book' of the to do!  This is exactly what you need, read all about it here.

  • Remove the paragraph style name space

    Hi all

    There is a space character at the end of my paragraph style name.

    How can we delete [space] after the end of the paragraph style name? I don't want to delete [space] if she came between paragraph style names.

    Please provide the js code.

    Thank you

    Tansk

    Please provide the js code.

    Oh sure, you hurry, right?

    You can not call the forum for all the subordinate tasks script? Please? In these six hours you were to twiddle their thumbs and nervously checking the forum every five minutes or so, you could do this by hand.

    Oh whatever:

    for (p=2; p		   
  • 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!");

    }

  • Why can I not use the style copy/paste utility

    Hello

    I have a spreadsheet with about 300 lines and columns at least 4. It is an overview of vegetables and fruit I use (d) growing in my garden. I want to insert a picture in each row, I stuck a picture in the first cell. Unfortunately many don't re - format the row and column so that the image fits, so I had to do it by hand. I selected this cell, copy the style and tried to stick the style to other cells (down). Nothing happened.

    What's not?

    Thanks in advance for your help.

    Hans

    Hello Hans,.

    When you paste an image into a table of numbers cell, image is pasted as a "Filling of Image" and, by default, is scaled to fit the current size of the cell.

    'Fill' is part of the Style of this cell and is included when you copy Style. Row height and column width, which together define the size of the cell, do not part of the properties of the cell Style and are not copied or pasted when you copy or paste Style.

    In the table below, your image (a page from this page, if less than your original resolution) was pasted in A1. The cell has been selected then copied Style (option + command + C), then the Style was pasted (option-command-V) in each of the cells on a diagonal. Heights and widths of column and line were adjusted by dragging the bars dividing the labels of name of column and row in the above reference tab bars and the left of the table, giving the shown result.

    Cell Format Inspector offers five choices of fitting of picture fill in a cell. Scale of adjustment is the default and forced the image according to a size that fills the cell in one direction, but leaves gaps in the other direction. In the example below, most copies of the image are limited by the width of the cell in tone are filling. Some, especially on the top row, is constained by the height of the line.

    Size of rows and columns may be defined by dragging, as I've done above, or in the table Inspector.

    Kind regards

    Barry

  • Titles or subtitles of the file name?

    Is it possible to automatically generate the titles or subtitles of the file name? I have a video made up of several small files and you need to insert their names under the name of a chapter, or at least as a subtitle. FCPX only supports to support the generation of TC.

    The short answer (obtuse) is not. Not in FCPX alone.

    I seriously doubt you will be interested in this procedure, but someone might be.

    You need movement (this is the only expense here), TextWrangler and a droplet of Automator (see below).

    First, gather all your files of clips in a folder.

    Drop the file on the files in the folder (the automator app/drop) that will create a text file with the names of all files in the folder. When you are prompted to save the file, you can name it and save it wherever you want.

    Gout Gets the names of files from the Finder, and they are complete paths, such as:

    / Users/fx/Desktop/txtLicenses/Aardvark Cafe readme.txt

    [You can download a copy of the 'Files in the folder' drop HERE ]

    Open a window in TextWrangler, and then drag the text file to a blank page (very cool - TextWrangler automatically opens the file with drag and drop.) [TextWrangler is FREE of Barebones.com (http://www.barebones.com/products/textwrangler/) software, everyone should have a copy! The most recent version is 5.0.2 in date 25/12/2015]

    Type the command + F to open the Find/Replace dialog box. Make sure that Grep is checked.

    To find them, use this regex:

    .*\/(.+)\.. +

    [translated: find everything up to and including the last ' / ' character, can find everything up to the last period and save it as a game (the parenthesis) and then find everything at the end of the line]

    As an alternative, use:

    \1\n

    [Translated: prints the substring and adds a newline character - it will be double space lines of text]

    In the drop-down menu with the label of 'g', save... (model - something like Remove Path and FileType) so you can find it again easily.

    The text from the above example will become:

    Aardvark Cafe readme

    [and will follow an empty line]

    [I recommend you do all your spelling at this point.] Make sure that all text is as you want it to appear in FCPX. Repair later gets a bit dicey. and generally it is a good idea to start over if you need to make changes to the text file.]

    Save the file with another file in TXT format.

    On the move:

    Create a project generator. It can be almost any length, so accept the default value of 10 seconds. You will be stretching out in FCPX in any case.

    Add: Generators > text > file

    [You can use the Inspector to Format to choose the font, size, etc. and the inspector looks for color and 3D options].

    In the Inspector of the generator, find the section, load your text file

    Set the speed to Custom

    Reset the Custom speed setting

    Publish the speed of Custom setting slider

    Save in FCPX (and create a category called subtitles)

    When you save the generator in FCPX, the file being used is hard-copied in the media for access folder. You cannot publish the setting browse generator, so all files subtitles prepared in this way are projects of "One Shot". You can throw away them once your project is completed because their utility essentially died with the FCPX project.

    In FCPX, apply the generator to the plot and develop it to adapt to the length.

    Keyframe of the lines of text to match the timing of your video. This is where double spacing will be useful because it is a real pain in simple lines of keyframe and you will need a bit of space for a step-by-step. You can, of course, import the audio portion of your story in motion, create a project for quite a long time for the entire length and key image subtitles in movement. You can export as, eventually, the subtitle project as ProRes (if you do not use 4444, then you can apply the Composite blend mode add to the layer that you use in FCPX as the background should be black.)

    If all of your clips are the same length of time, then using the subtitle generator is a snap. Set a keyframe at 0 for the appearance of the first line and in the end, the last line should appear, simply drag the speed until the last line shows control (should be at or close to 100%). The generator systematically displays a single line both throughout the progression of his 'read'

    I found that the faster is to import the audio in motion and create a Motion project, the length of the audio used for subtitles + a little extra at the end.  Listen to the audio, and for each line that you display, add a keyframe... little whatever it is. When there is a keyframe for each line, listen again and adjust keyframe values to display the line. This will leave you with linear transitions from one image to another key (and overlapping in some cases, or the appearance of lines before image real key because of "Rounding errors") - is NOT a problem! Just select 1 keyframe, type command + A to select all the keyframes, and then right-click on a keyframe and select constant on the menu drop down. This will create a step-by-step through each value and you give the * discreet * timing you have need for the text to appear at the right time.  Remove the audio track and save the project as a generator of FCPX... it is faster and easier to export a track video overlay.

    You need movement 5.1.x or better (there are serious problems with 5.0 versions and file generator.)

    I know it doesn't look like it, but this method of captioning is much easier than ANY other software of captioning I've tried in the past... NO timecode or the special formatting is required... other recommended spacing to double.

    HTH

  • Cut and paste in Indesign style names

    Hello everyone, I'm new to this forum.

    I have a question about the cut and paste in Indesign: Let's say I have two documents.

    -In the first, I have several rules of paragraph style, let's say style1, style2, style3.

    -In the second document, I have exactly the same paragraph style (style1, style2, style3) names, but different formatting rules (for example in doc1 style1 is 13 times, the same style1 doc2 is Minion 11).

    What I want to do is to copy the text of document 1, the selected paragraph style name, but not the setting shaped styles. So when I did the copied text in document 2, can I get the text automatically style with rules of formatting of document 2.

    I can't find a way to do it: I cut & spent keeping the formatting, but not the names of the styles only.

    Did someone in the face of this problem or have a solution?

    Thanks in advance for your help.

    Hi everyone and thanks for your help.

    I finally found out why the cut & paste has not worked for me.

    The problem was that in doc1, I put all my styles in a folder, while in doc2 (take a guess!) No.

    That was the problem. Once I put in a folder with the same name as doc1 doc2 styles, everything worked magically.

    Thank you very much!

    Fabio

  • How to identify the style used in Photoshop?

    I have prepared a text with style, but I can't find out witch style is in the style gallery (I simply give upt). There are just miniature without any name - how to find it, I have a lot of styles.

    prepared a text with style

    A paragraph or character style? Just click an insertion point in formatted text and look at the window > paragraph Styles (or if a character style, window > character Styles) and it will be highlighted in the list. Before you forget, double-click it in the Panel and give it a name short and descriptive.

  • Base - Add the user name and password in script?

    Hello

    Scripting is not my thing, I run the script below in order to get the use of the data store space and it requires user name and password for vcenter, how do I add it in the script, then I can run as a scheduled task on my Windows Server that has installed PowerCli?

    # These are the properties assigned to the table via the ConvertTo-HTML cmdlet.

    $tableProperties = '< style >.

    $tableProperties = $tableProperties + "TABLE {border-width: 1px;}. border-style: solid; border-color: black ;} »

    $tableProperties = $tableProperties + "TH {border-width: 1px;}. padding: 5px; border-style: solid; border-color: black ;} »

    $tableProperties = $tableProperties + "TD {text-align: center;} '. border-width: 1px; padding: 5px; border-style: solid; border-color: black ;} »

    $tableProperties = $tableProperties + ' < / style >.

    ##The script will automatically connect to the server if necessary. The $server variable must

    #be changed if the server name changes.

    $server = "192.168.132.1".

    If (!) () to connect-viserver $server - ErrorAction SilentlyContinue). IsConnected)

    {

    Write-Host "connection to the server: ' $server

    to connect-viserver $server - ErrorAction SilentlyContinue err - ErrorVariable

    If ($Err)

    {

    Write-Host "Connection to the server error, please check server name." - ForegroundColor Red

    breaking

    }

    Write-Host "Full" - ForegroundColor Green

    }

    # cmdlet to retrieve information from data warehouses.

    # variable $rep stores all the information for each data store.

    $rep = @)

    Get-Datastore. Sort-Object-property name. {ForEach-Object

    $Datastore = $_

    $Report = "" | Select-Object - property Datastore, CapacityGB, FreeSpaceGB, PercFreeSpace

    $Report.Datastore = $Datastore.Name

    $Report.CapacityGB = [math]: tour ($_.) CapacityMB / 1 KB, 0)

    $Report.FreeSpaceGB = [math]: tour ($_.) FreeSpaceMB / 1 KB, 0)

    $Report.PercFreeSpace = [math]: Round (((100 * ($_.))) FreeSpaceMB)) / ($_.) (CapacityMB)), 0)

    $rep += $Report

    }

    # Formats date, file name, etc. #.

    #Write - Host "Generating report".

    $date = get-date

    $datefile = get-date - uformat ' %d-%m - Y % - hour %M ' %S

    $filename = "C:\vmware\powercli\reports\VMwareDatastoreUsage_" + $datefile + ".htm".

    # Generates vsphere datastore usage report #.

    Write-Host "Full" - ForegroundColor Green

    Write-Host "Generating datastore usage report".

    $rep | Sort PercFreeSpace | ConvertTo-HTML-head $tableProperties - body ' < th > < font style = ' "color: #000000 '" > < big > < b > VMware Datastore using < /b > < / big > < / font > < /th > | Out-file $filename

    Write-Host "Full" - ForegroundColor Green

    Write-Host "usage of your data store report has been saved to: ' $filename

    ##Send email with attached generated report #.

    #Write - Host "sending email with report:" $filename + "attached".

    Send-MailMessage-to "vmware-reports < . " [email protected] >"-subject 'vSphere datastore use' - to ' Andy White < [email protected] > "-body" VMware report attached: use of the data store "- attachment $filename - high - dno onSuccess, onFailure - smtpServer 192.168.13.3

    The connection is made in this line

    SE connect-VIServer $server - ErrorAction SilentlyContinue err - ErrorVariable

    You can add the user and password parameters of the cmdlet Connect-ViServer . But you want to have this info hardcoded in the script?

    An alternative is to use the credentials store.

    There are other alternatives to store the credentials.

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

  • Move the style Group paragraph styles

    Hello

    I want to spend the paragraph styles of Group of paragraph style to the paragraph style palette.  I use the code to do so below.  Styles of the style group is moved outwards but on display inside the style group. All the elements of paragraph style are no name moved style return.  He took the last paragraph style in the style group.

    test (App.activeDocument.paragraphStyleGroups);

    Alert (app.activeDocument.paragraphStyles.length + "-" + app.activeDocument.paragraphStyles.everyItem () .name)

    function test (PPMs)

    {

    try {}

    for (var i = sGrp.length - 1; i > = 0; i--)

    {

    cstyleGrp = PRGS [i];

    for (var j = cstyleGrp.paragraphStyles.length - 1; j > = 0; j-)

    {

    var cstylGrpStyle = cstyleGrp.paragraphStyles [j];

    cstylGrpStyle.move (LocationOptions.AT_END, app.activeDocument.paragraphStyles [app.activeDocument.paragraphStyles.length - 1]);

    cstylGrpStyle.move (LocationOptions.AT_END, null);

    cstylGrpStyle.move (LocationOptions.AFTER, app.activeDocument.paragraphStyles [0]);

    }

    If (cstyleGrp.paragraphStyleGroups.Length > 0)

    {

    test (cstyleGrp.paragraphStyleGroups);

    }

    }

    } catch (e) {}

    }

    Screen shot 2015-07-07 at 2.02.08 PM.png

    Screen shot 2015-07-07 at 2.02.26 PM.png

    You can get the behavior very buggy if you aren't careful with moving paragraph styles!

    Either way, the right way to move from a paragraph style is like this (you will need to edit the code below as well as p becomes a reference to a real paragraph style):

    d = app.activeDocument;

    p = / * some paragraph style in a group of para-style * /.

    The following line move p in paragraph style out of his group and in the list of paragraph styles in the document d

    p.Move (LocationOptions.UNKNOWN, d);

    HTH

Maybe you are looking for