[AS] [CS6] Apply different styles in the context of a text

Hello

Currently I have an AppleScript script to fill a block of plain text with a series of chains:

say MyTextFrame to define (content of the history of the mother) to MyText1 & MyText2 & MyText3 & MyText4

I would like to apply a different style (MyStyle1 to MyStyle4) for each of these channels (MyText1 to MyText4).

Precision: MyTextI strings can contain a word or a paragraph or more, so I can't apply a style to a paragraph, for example.

Thomas

See the syntax below

Please note that, while the js elements begin a 0 as start at 1, so you will have to set that in the script by Uwe

Tell application "Adobe InDesign CS6"

Set myDocument to the active document

page 1 of myDocument, myPage value

myTextFrame value framework text 1 of myPage

tell the parents of myTextFrame

Reference value character myText 1-character - 2 of paragraph 1 of the text object

say myText

apply the character style with the character style "myCharStyle" of myDocument

tell the end

tell the end

tell the end

look at examples in manual https://www.adobe.com/content/dam/Adobe/en/devnet/indesign/cs55-docs/InDesignScripting/InD esign-ScriptingGuide - AS.pdf

A very useful guide indeed

Trevor

Tags: InDesign

Similar Questions

  • Help: apply different styles of Pará to several consecutive paragraphs using the script

    Hi all

    I need to apply different styles of Pará to several consecutive paragraphs using the script, something like this (found somewhere on the net):

    myDoc = app.documents var [0];

    mySel var = app.selection [0];

    var myPStyle1 = "A";

    var myPStyle2 = 'B ';.

    you need to add 6 styles here:

    var myPStyle3 = 'C ';

    var myPStyle4 = "D";

    var myPStyle5 = 'E ';

    var myPStyle6 = 'F';

    var myPStyle7 = "G";

    var myPStyle8 = 'H ';

    the last style is not necessary in the script?

    apply style 1 paragraph 1

    mySel.appliedParagraphStyle = myDoc.paragraphStyles.item (myPStyle1);

    apply styles to the paragraphs after selection

    style 2

    mySel.paragraphs [-1] .insertionPoints [-1] .appliedParagraphStyle = myDoc.paragraphStyles.item (myPStyle2);

    next style

    mySel.paragraphs [-1] .insertionPoints [-1] .paragraphs [0] .insertionPoints [-1] .appliedParagrap hStyle = .nextStyle myDoc.paragraphStyles.item (myPStyle2);

    I tried a lot, but could not find the way to extend the sequence

    Sorry, no skills in the scripts still...

    all styles have "Next Style" option enabled, but I can't use ' apply style, then next style "or object styles, because I need four different sequences of these paragraph styles:

    A-B-C-D-E-F-G-H

    A-B-D-E-G-H

    A-C-D-F-G-H

    A-D-G-H

    and I don't really want to create special clones of the same style for each sequence (Keep It Simple, they say ).

    I think that this can be done through four slightly adjusted scripts...

    any suggestions would be greatly appreciated...

    Sorry to be late to the party, I usually take up such things immediately.

    How about this one?

    1. no separate necessary script, it uses a small dialog box where you can choose what style to use. If I'm not mistaken, you can press a digit key on Windows to immediately select one of the items.

    2. it works down in the paragraph in that your cursor is located. It has nothing to do with the blocks of text, even if - consecutive paragraphs within a story always ignore the text frames.

    3. extensible: you can easily change the names of the styles in the table at the top of the page and the number of groups of style in the list.

    var styleLists = [
              [ "A", "B", "C", "D", "E", "F", "G", "H" ],
              [ "A", "B", "D", "E", "G", "H" ],
              [ "A", "C", "D", "F", "G", "H" ],
              [ "A", "D", "G", "H" ]
    ];
    
    var radiobutts = [];
    
    styleDialog = app.dialogs.add ({name:"Set Multiple Styles",canCancel:true});
    with (styleDialog)
    {
              with (dialogColumns.add())
              {
                        with (radiobuttonGroups.add())
                        {
                                  for (i=0; i		   
  • How to apply different styles to several spry accordion panels?

    Hi all

    I have a site I'm building that has several functions that spry accordion.

    I try to apply different styles to each accordion. A problem arises when I try to place an accordion in an another accordion.

    I have style two images of different background for both of the accordians for styles (AccordionPanelTab, AccordionPanelTabHover and AccordionPanelOpen AccordionPanelTabHover) that work very well.

    When I try and place an accordion in an another accordion background image for this Accordion for styles (AccordionPanelTab and AccordionPanelOpen AccordionPanelTabHover) has different style applied that I said in the accordion.css folder, however the style (AccordionPanelTabHover) has the same style as the accordion, it's breast, even if I said a background image in the accordion.css file different.

    I hope this makes sence, below is my source and the CSS Code.

    I appriciate any help that can be given to help solve this issue I'm running too.

    Source code

    < div id = "content" >

    < p > < span class = "first_header_word_packages" > welcome </span > < span class = "header_word_packages" > on our page of packages </span > < / p >

    < class p = "content_txt" > here you can build the package Web site that meets your needs while being able to determine the cost of your site without having to worry about the scary hidden costs at a later date. < /p >

    < class p = "content_txt" > we have two packages available for our clients; < /p >

    < div id = "Accordion1" class = "Accordion" tabindex = "0" >

    < div class = "AccordionPanel" >

    < div class = "AccordionPanelTab" > < / div >

    < div class = "AccordionPanelContent" >

    Here the text < p > < /p >

    < div id = "Accordion2" class = "Accordion" tabindex = "0" >

    < div class = "AccordionPanel" >

    < div class = "AccordionPanelTab" > < / div >

    < div class = "AccordionPanelContent" >

    Here the text < p > < /p >

    < / div > <! - end #Accordion2 content - >

    < / div > <!-end #AccordionPanel->

    < / div > <!-end #Accordion2->

    < / div > <! - end #Accordion1 content - >

    < / div > <!-end #AccordionPanel->

    < / div > <!-end #Accordion1->

    < div id = "Accordion3" class = "Accordion" tabindex = "0" >

    < div class = "AccordionPanel" >

    < div class = "AccordionPanelTab" > < / div >

    < div class = "AccordionPanelContent" >

    Here the text < p > < /p >

    < div id = "Accordion4" class = "Accordion" tabindex = "0" >

    < div class = "AccordionPanel" >

    < div class = "AccordionPanelTab" > < / div >

    < div class = "AccordionPanelContent" >

    Here the text < p > < /p >

    < / div > <! - end #Accordion4 content - >

    < / div > <!-end #AccordionPanel->

    < / div > <!-end #Accordion4->

    < / div > <! - end #Accordion3 content - >

    < / div > <!-end #AccordionPanel->

    < / div > <!-end #Accordion3->

    < / div > <!-end #content->

    CSS

    @charset "UTF-8";

    / * SpryAccordion.css - version 0.5 - Pre - Release Spry 1.6.1 * /.

    / * Copyright (c) 2006. Adobe Systems Incorporated. All rights reserved. */

    / * This is the selector for the main container of the accordion. For our style by default.

    * draw us left, right and bottom borders. The upper edge of the accordion

    * is made by the first AccordionPanelTab which never moves.

    *

    * If you want to limit the width of the Accordion widget, set a width

    * the accordion container. By default, our accordion expands horizontally to fill

    * a space available.

    *

    * The name of the class ("accordion") used in this switch is not necessary

    * make the widget function. You can use any class name you want to style the

    * Accordion container.

    */

    . Accordion {}

    border-left: 1px solid gray;

    border-right: 1px solid black;

    border-bottom: 1px solid gray;

    overflow: hidden;

    }

    / * This is the selector for the AccordionPanel container which houses the

    * tab panel and panel content area. It is not make it visually, but we

    * ensure that it has zero margin and padding.

    *

    * The name of the class ("AccordionPanel") used in this switch is not necessary

    * make the widget function. You can use any class name you want to style a

    the container of accordion panel.

    */

    . {AccordionPanel}

    margin: 0px;

    padding: 0px;

    }

    / * This is the selector for the AccordionPanelTab. This container houses

    the Panel personnel. It is also the container where the user clicks

    * to open a specific panel.

    *

    * The name of the class ("AccordionPanelTab") used in this switch is not necessary

    * make the widget function. You can use any class name you want to style a

    the container of Accordion Panel tab.

    *

    * NOTE:

    * This rule uses the - moz-user-select and - khtml-user-select properties to prevent the

    * the user to select the text in the AccordionPanelTab. Here is the browser owner

    properties that only work in Mozilla browsers (such as FireFox) and KHTML

    * browsers (such as Safari), so they will not pass the W3C validation. If you want your documents to

    * validate and don't care if the user can select text in an AccordionPanelTab.

    * You can remove these properties without affecting the functionality of the widget.

    */

    . {AccordionPanelTab}

    background-color: #CCCCCC;

    border-top: 1px solid black;

    border-bottom: 1px solid gray;

    margin: 0px;

    padding: 2px;

    cursor: pointer;

    -moz-user-select: none;

    -khtml-user-select: none;

    }

    / * This is the selector for the content area of a Panel. It is important to note that

    * You should never put any padding on the content area of the group if you plan to

    * use the animations of accordion panel. Place padding non-zero on the content

    * area can cause accordion suddenly increase in height, while signs alive.

    *

    * Anyone who styles an accordion * MUST * specify a height on the Accordion Panel

    * Content container.

    *

    * The name of the class ("AccordionPanelContent") used in this switch is not necessary

    * make the widget function. You can use any class name you want to style a

    the container of the accordion panel content.

    */

    . {AccordionPanelContent}

    overflow: auto;

    margin: 0px;

    padding: 0px;

    }

    / * This is an example of how to change the appearance of the tab of the Panel which is

    * currently open. The "AccordionPanelOpen" class is added and removed programmatically

    * to panels as long as the user clicks on the tabs in the accordion.

    */

    . AccordionPanelOpen. {AccordionPanelTab}

    background-color: #EEEEEE;

    }

    / * This is an example of how to change the appearance of the tab of the Panel as the

    * mouse passes over it. The "AccordionPanelTabHover" class is added programmatically

    * and removed containers tab panel as the mouse enters and leaves the tab container.

    */

    . {AccordionPanelTabHover}

    color: #555555;

    }

    . AccordionPanelOpen. {AccordionPanelTabHover}

    color: #555555;

    }

    / * This is an example of how to change the appearance of all the Panel tabs when the

    * Accordion has focus. The class "AccordionFocused" is programmatically added and removed

    * whenever the accordion wins or loses the keyboard focus.

    */

    . AccordionFocused. {AccordionPanelTab}

    background-color: #3399FF;

    }

    / * This is an example of how to change the appearance of the tab of the Panel which is

    * currently open when the accordion is in focus.

    */

    . AccordionFocused. AccordionPanelOpen. {AccordionPanelTab}

    background-color: #33CCFF;

    }

    / * Printing rules * /.

    @media print {}

    . Accordion {}

    overflow: visible! important;

    }

    . {AccordionPanelContent}

    display: block! important;

    overflow: visible! important;

    height: auto! important;

    }

    }

    #Accordion1. {AccordionPanelTab}

    height: 75px;

    Width: 285px;

    Background: url (.. /images/package_spry_tab_bg1.png) ;}

    #Accordion1. AccordionPanelTabHover,

    #Accordion1. AccordionPanelOpen. {AccordionPanelTabHover}

    Background: url (.. /images/package_spry_tab_bg1_RO.png) ;}

    #Accordion2. {AccordionPanelTab}

    height: 44px;

    Width: 469px;

    Background: url (.. /images/packages_spry1.png) ;}

    #Accordion2. AccordionPanelTabHover,

    #Accordion2. AccordionPanelOpen. {AccordionPanelTabHover}

    Background: url (.. /images/packages_spry1_ro.png) ;}

    #Accordion3. {AccordionPanelTab}

    height: 75px;

    Width: 285px;

    Background: url (.. /images/package_spry_tab_bg2.png) ;}

    #Accordion3. AccordionPanelTabHover,

    #Accordion3. AccordionPanelOpen. {AccordionPanelTabHover}

    Background: url (.. /images/package_spry_tab_bg2_RO.png) ;}

    #Accordion4. {AccordionPanelTab}

    height: 44px;

    Width: 469px;

    Background: url (.. /images/packages_spry2.png) ;}

    #Accordion4. AccordionPanelTabHover,

    #Accordion4. AccordionPanelOpen. {AccordionPanelTabHover}

    Background: url (.. /images/packages_spry2_ro.png) ;}


    Good guys.

    I thought about it, if someone had the same problem as me and a look at this thread for the answer, here it is.

    Firstly if you are wanting to separately style two or more Spry accordions that are not on the other example

    Label 1

    Insert content here

    Label 1

    Insert content here

    Do not do this, as long as you have separate ID's for the div (which dreamweaver automatically anyway), you will be fine.

    However if for some reason, you want to put one accordion inside another like I did for example

    Label 1

    Insert content here

    Label 1

    Insert content here

    Too style accordion 1 and 2 so their tabs have different origins and Hover background when the content panel is open and closed you need to style it in CSS that they follow the path;

    CSS

    #Accordion1. {AccordionPanelTab}

    height: 75px;

    Width: 285px;

    Background: url (.. /images/package_spry_tab_bg.png) ;}

    #Accordion1. AccordionPanelTabHover,

    #Accordion1. AccordionPanelOpen. {AccordionPanelTabHover}

    height: 75px;

    Width: 285px;

    Background: url (.. /images/package_spry_tab_bg_RO.png) ;}

    #Accordion2. {AccordionPanelTab}

    height: 44px;

    Width: 469px;

    Background: url (.. /images/packages_spry.png) ;}

    #Accordion2. AccordionPanelClosed. AccordionPanelTabHover,

    #Accordion2. AccordionPanelOpen. {AccordionPanelTabHover}

    height: 44px;

    Width: 469px;

    Background: url (.. /images/packages_spry_ro.png) ;}

    Normally in styling two separate spry accordions, you can simply use the following code

    #Accordion1. {AccordionPanelTab}

    height: 75px;

    Width: 285px;

    Background: url (.. /images/package_spry_tab_bg.png) ;}

    #Accordion1. AccordionPanelTabHover,

    #Accordion1. AccordionPanelOpen. {AccordionPanelTabHover}

    height: 75px;

    Width: 285px;

    Background: url (.. /images/package_spry_tab_bg_RO.png) ;}

    The only difference with the style one Spry Accordion in another so that they have different horizons stationary when the content panel is open and closed ".» AccordionPanelClosed ".

    Hope this has helped someone who had the same problem, I was.


  • How to format different paragraphs in the same block of text quickly

    Hello world

    I have 7 paragrahs as part of a text. How can I give a paragraph style 1,3,5,7 and 2,4,6 another syle in a quick way, by which I mean that I don't have to click on every single paragraph and the syle apple every time. Is it possible that I can apply a style to the text frame, and when I place the 7 paragraphs, they will be automatically formatted as I mentioned above. I tried to use the nested style, but I found the nested style is only used for formatting different parts of a single paragraph. Am I wrong?  It will be greatly appreciated if anyone can come back to me. Thank you!

    Simon

    If style 1 is listed as "next style" style 2 and vice versa, you can select all the text, then right click on the name of the style you Wan to apply to the first paragraph and click on apply the style and the styles and following style allows to scroll the selection.

  • Photoshop CS6 rotates 90 degrees to the right alignment of text characters istead vertically?

    Photoshop CS6 rotates 90 degrees to the right alignment of text characters istead vertically?

    I have the same exact problem as this thread.

    The solution is change option East Asia and rearmament of the preferences, but mine is still typing horizontally at a 90 degree angle. Anyone know of any other way?

    Have you tried to reset the text tool and reset the characters available in ground #1.

    Kind regards

    Mohit

  • In Photoshop CC2015-how I automatically apply a style to the shape layer that I draw?

    HI -.

    I work in an office with a few different versions of Photoshop on Windows 10.

    On my CS5 PSD I can draw some shape layers, like arrows and have all the styles applied automatically style palette that I draw.

    But the fellow with PSD CC 2015 workers need to use 2 markets - draw shape layer and then select the style in the style palette.  None of the settings on the top of the screen seem to allow us to apply the style we attract.

    Is there a hidden area or a preference?

    The automatic application of a style has been removed from Photoshop?

    TIA your answer.

    J2

    This is not possible with the latest Photoshop shape tool. If you want that it is a characteristic shape tool like Photoshop old tool form the best you can do is submit an idea on the Adobe site comments but you hold no breath hoping Adobe will implement your idea.  If you want this feature you will now need to regress to an older version of Photoshop as CS2. This is the version of Photoshop, I used for my second screenshot, Photoshop community customer family

  • CSS - adding a different style to the page

    I have attatched the HTML code of the template I created for the site.

    If you are able to open it, you can see my < style type = "text/css" > area is really simple and clear (the only real style is the color of link... which is white).

    So yes, it is very well: on each page, I have the comments | The history of Oz as links that are white. Fantastic. But this style is applied to all the other links on the Web site. For example, I have a purchase order where you can click on the text of the item you wish to purchase, and a window opens. However, the link that click you on ISA... Unfortunately White. The background is white, making it difficult to read (duh). So I was wondering how can I ask a second .style my model. I tried .style2 and then bla bla bla, but that just changed my words | The history of Oz links.

    Help! Thanks :)

    goodridge_Winners wrote:
    > hmm thank you walt... but how to make a second style? is it as simple as typing in
    >

  • I have 2 different styles for the reference numbers and the reference text?

    Hello

    I have a document with a lot of notes.

    I would attribute all reference to a character style numbers and all of the text in a different character style.

    For example, I would like to have numbers in bold and black, while the reference in light and dark grey text.

    Doing this manually is not an option of course.

    Is this possible?

    If this is not the case, is there scripts out there that can control it?

    Thank you

    Federico

    It's easy to do.

    1. A Style of Chyaracter for the reference number of the ridge.
    2. Implement the paragraph for the reference text Style.
      1. Go to the nested Styles section
      2. Select the character Style
      3. Apply it to the first separator symbol specified (as tabulator) you chose when you set up your notes.
    3. Use it. It will apply automatically. Of course, you must choose the paragraph Style reference in the Set Up parameters of reference from the Type menu.
  • Use conditional tags to apply different Style sheets / Skins for purposes of brand?

    RoboHelp HTML > WebHelp appearance of layout using conditional build tags

    I have a client that provides an application to different companies and brands its product by changing the look, using a style sheet selected depending on the brand.

    Is there a way to customize a WebHelp layout, to select a style sheet and a skin 's brand, and another sheet of style and skin for the brand Band so on?

    Would this work in RH7? (The client uses this for the moment.)

    Would this work in RH8? (They could improve if this solves the problem.)

    Philip Tory, technical author

    Hello Phillip

    RoboHelp 8 offers capacity to appoint a specific CSS file in the presentation of single Source recipe. So sure.

    See you soon... Rick

    Useful and practical links

    Wish to RoboHelp form/Bug report form

    Begin to learn RoboHelp HTML 7 or 8 days - $24.95!

    Adobe Certified RoboHelp HTML Training

    SorcerStone blog

    RoboHelp EBooks

  • GREP style - apply character style to the opening and closing parentheses surrounding a 0 (but not 0)

    Hello

    I'm relatively new to GREP style and will have to put in shape about 600 postcards containing various data (via the merger of data), including phone numbers. Consider the following data set:

    1. + 44 (0) 123467800

    2 (©) copyright

    3. (name of the program)

    I want to tell Indesign to stagger the opening and the closing parenthesis of the baseline (with a character style), but only the bracket that include a 0 and, possibly, without affecting the 0 value between them.

    Seems like an easy task, but it is impossible to find a solution. Could someone help?

    Thank you very much

    Antonio

  • Whenever the computer is started, two different styles of start menu appear on the screen, divided vertically from left to right.

    Original title: is this monitor or windows?

    This condition began while I was running xp sp 3.

    I worked in google earth at the time.

    I don't remember exactly what happened.

    But now, every time I start windows, two different styles of the start menu

    appear on the screen, divided vertically from left to right.

    The menu on the right can only be extended to about half of the control panel to the left.

    The menu on the left can grow to the right once the right image has been reduced.

    I tried to reset the start menu in the program settings without success.

    Anyone have any ideas?

    I hope that I was clear enough with this info.

    The article you referred to seems to apply to vista and windows 7.

    How ever, before I received your reply I had already solved the problem myself"

    I appreciate the proposed both help Lisa M and Azeez 'n'

    No further assistance is necessary.

    Thanks again.

  • Styles different links in the body and the footer?

    Hello

    I want to style links for hyperlinks in the page footer, they are in the body of the site.  Is it still possible?

    The problem is that the body background is white, and footer background is dark brown. So there is no way that I can use the same styles for links.

    I know that there is no "Workaround" that connects the blocks of text, but this isn't what I want.

    Thank you!

    Matjaz

    Please refer to the Link Styles FAQ thread and apply different styles to your links in the footer and body.

    http://forums.Adobe.com/thread/982968

    Thank you

    Vinayak

  • How to use the different style sheets for ChangeAttributeRequest workflow in OAM

    Hello

    We have a requirement to invoke different change attribute request workflows (change password, change email etc.) of external JSPs.
    I want to apply different style sheets for each workflow. In the URL of the workflow if I get style = the style sheet name its not not using this stylesheet. Its still using the same basic (wf_changeattr.xsl) stylesheet. How can I use different style sheets? Pointers on this is appreciated.

    Thank you inadvance.

    Kind regards
    Srikanth

    Hi Srikanth,

    Are you using & xsl = stylesheetname or & style = parameter? XSL = must specify a specific xsl file, while & style specifies a complete style (for example & style = style0 for the default style).

    Kind regards
    Colin

  • Work plans have a different style of grid and the bottom

    Hello

    Something that was annoying me greatly is the style of grid and the bottom of the document (not the actual work plan or the canvas, I mean the application background) in the work plan 'mode '. If you select a predefined based work plan (like the web 1920 x 1080) switches the document to the mode of work plans, it seems. That means that you have a completely different style of the grid (an a terrible, because the lines are much thicker than they should be) and also if you have selected a background color personalized for photoshop, it is more gets respected. See the example below.

    Keeping in mind I use windows. I don't know if that makes a difference here.

    artboardproblem.png

    What gives? Since I use a grid for most of my work, it makes the work plans unusable for me.

    See you soon,.

    RIHO

    Thanks, Riho, we logged this as a bug.

  • apply existing styles to paragraphs

    I have a little problem. How to apply existing styles. Different style to the first, second and third paragraph of the story/selection. I think it's simple, but I can't solve the problem. Thank you.

    It's pretty easy:

    mySelection var = app.selection [0];

    var paraStyle1 = app.activeDocument.paragraphStyles.itemByName ("style1");

    var paraStyle2 = app.activeDocument.paragraphStyles.itemByName ("style2");

    etc.

    mySelection.paragraphs [0] .appliedParagraphStyle = paraStyle1;

    mySelection.paragraphs [1] .appliedParagraphStyle = paraStyle2;

    etc.

Maybe you are looking for

  • Re: Satellite A200 - 1ZF Win XP & Toshiba control buttons do not work

    Hello I have a Satellite A200-1ZF with Vista installed initially.I removed Vista and install XP. Then installed all the drivers and almost everything works but these keys (power, www, mediaplayer, play, stop, back then) on the upper part of the phone

  • The pencil of apple works through a protective screen

    A screen in tempered glass protector will have no effect on the use of a pencil to Apple. It is with a Pro for the Ipad. I understand that they are robust enough, but these are my grandchildren, 3, 7,8,9,14. Children love the drawing and will love th

  • Word 2007 add-in tab is not visible

    Using XP SP3 and Office 2007.  The addin tab as well as supplements that I installed and selected to be used in the Options-> Addins do not appear.  There's two new identical systems to Acer with SP3.    I wanted to try to remove Service Pack 3 Windo

  • Power supply for desktop options

    When I go into Power Options Properties for my desktop/tower PC I get 2 sets of parameters: Plugged In and running on Batteries. How can this be? How can I get rid of the column running on Batteries? Thank you the

  • Firepower 6.0

    Dear, I added 2 managed devices asa 5525 X I have not configured any access control strategies is all about default, according to the attachment I get an obsolete message on 2 target devices, I get no button apply highlighted, if this configuration i