Automate the character styles?

Tuesday morning, I sit and one hundred and fifty summer events to pop in a leaflet. Choice is easy - I can print them and type them. In the shower, however, I started thinking about choice B, and I don't know if InDesign can do what I want.

I have control over the database where they are hosted, and it is quite easy for me to pop in the format

~~~~~~~~~~~~~~~~~~~~~~~~~~
Date - time [CR]
Name of the event
~~~~~~~~~~~~~
Date - time [CR]
Name of the event
~~~~~~~~~~~~~
Date - time [CR]
Name of the event
~~~~~~~~~~~~~

What is all the information I need on this document. On the finished product, I'll Date and time to have character styles applied (for color and weight). It is not difficult for me to assign keys quick access to styles of character and to make this hand - twenty minutes of boredom.

But!

Could format that

(where the symbols are just unique symbols)

~~~~~~~~~~~~~
ªDate - ∞ £ time [CR]
Name of the event
~~~~~~~~~~~~~

and then use a find/replace to tell InDesign

-in the case of 'ª... ". ∞ ", apply the style of character 'Style of Date'

-in the case of "£...", apply the style of character 'Time style' "

and then go through and remove all instances of ª ∞, £ and

?

(Additional spaces applied for ease of reading)

Or, if I'm imagining this wrong, is there another way I can format the original data to automate the application of styles?

Even I don't think that you would need to grep for that.

I would create two paragraph styles, one for the date and time with the following style being the name of the event and the name of the event, including the next style time.

Then create a character for the time style and have the paragraph style base for date/time, or just for the date of the formatting you want.

The style of time date would have a style nested with none by the hyphen and the time until the end of the paragraph.

Place the text and then select everything from him and in paragraph styles, right panel click on time and in the context menu, choose apply date/time and following.

Who must fully put in shape all your text.

Bob

Tags: InDesign

Similar Questions

  • Table of contents, problems in applying the character style

    Hi all

    This is my first post, I checked if there was already something similar, but I can't find anything so I'm asking here.

    I work with Indesign 9.3 and I created a book of 80 pages and there are 20 + chapters.

    I wanted to create a table of contents, so I made an and I put my paragraph for her style, but I had problems to set the character style (he set only to the number of the page, but not to the number and the name of the chapter).

    When I create my summary style I have no problem to indicate the paragraph style that you want to use (and then it automatically applies it properly when I generate my list).

    The problem I want to solve, is that I need that my table of contents automatically the value of the character style, cause, for the moment, I have to apply it after its generation.

    Sorry for my bad English, I hope you understood

    Concerning

    Filippo

    In this case you must use the character for numers style nested within the paragraph style

    I'm usually two independent sparagraph styles (primary materials) chapters and sections (toc details). In this way, you can add a different same nested character style to stand them.

    Addibn later - style, it is not good idea. After the update of the table of contents, you have lost the

    macpawel

  • How can I set small caps in the character style

    I use the opportunity that you people are online:

    I'm trying to define small caps in the character style and it does not work,

    It works in the paragraph style, why is this? and is it possible around it?

    I can see the option in the character Styles: isn't it of menu drop-down available in your dialog box?

  • 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 write the script to apply the character style?

    Hello

    I'm on a Macbook pro and without a numeric keypad, so I can't assign a shortcut to character styles. I heard a roundabout solution where you can assign a shortcut to a script that applies the character styles. Can anyone write this script?

    My character style is called "features"bold. "

    I am new to scripting, sorry if this is a stupid question.

    See you soon

    Hello

    1. save this code as a file inside your Script Panel folder .jsx

    2. apply a shortcut using the menu Edit: shortcuts...

    Option to choose:

    • suggest you choose an option 'background': 'Text', so you can use several shortcuts that are occupied in other contexts.
    #target indesign
    if (app.selection && app.selection[0].hasOwnProperty ("baselineShift") ) {
      var cName = "Features bold";
      var mCstyle = app.activeDocument.characterStyles.item(cName);
      if (mCstyle.isValid)
           app.selection[0].applyCharacterStyle(mCstyle);
      else
           alert ("CharStyle: " + cName + " not found");
      }
    else
      alert ("Some text supposed to be selected...");
    

    Jarek

  • Apply the character style to the part of the paragraph

    I am inserting text in a block of text with the following code:

    story.insertionPoints [-1] .silence += pgfStr;

    story.insertionPoints [-1] .silence += "\t";

    story.insertionPoints [-1] .silence += refStr;

    story.insertionPoints [-1] .silence += "\r";

    I want to apply the character style to all of the text in refStr (only the part of this paragraph). I know how the syling paragraph applies to the entire paragraph, but not a character style. I should be grateful if you would help. Thank you!

    Hello

    Dan - BTP says:

    ... the size in points and attack can be different on each page...

    You are able to find a rule of these differences?

    ...

    What do depends on what type of rule could be defined

    ...

    The size of reference point that is 1.5 PT lower than the point size of the paragraph, whatever.

    Close to the end of the script, you can code for example:

         //     Your target is "reference" which is a text inbetween tabulator and end of story (or other criteria).
         //     So you could define:
    app.findGrepPreferences = null;      // just for clear it
    app.findGrepPreferences.findWhat = "(?<=\\t).+\\s\\Z";     //     to catch text following tab in last para of story
         //     and after:
    mFound = app.activeDocument.findGrep();
         //     so all desired text objects are in an array "mFound".
         //     you could iterate (backward) through it:
    len = mFound.length;
    while (len-->0)      //     ">0" in case of nothing found
         mFound[len].pointSize -= 1.5;
    
         //     whatever that is - is 1.5 smaller
    

    Jarek

  • Selection of parts and columns, or entire lines and apply the character style

    I am trying to apply character styles to certain parts/whole rows and columns.

    I can change individual cells with the following code...

    table = app.selection[0];
    if (table.hasOwnProperty("baseline")) table = table.parent;
    if (table instanceof Cell) table = table.parent;
    if (table instanceof Column) table = table.parent;
    if (table instanceof Row) table = table.parent;
    if (table instanceof Table)
    
    {
     table.rows[0].cells[6].texts[0].appliedCharacterStyle = "none report";
     }
    

    ... but when I try to select an entire line, I get the error 'Object does not support property or method' texts. "" "When I try one of the following two codes.

    {
     table.rows[0].cells.texts.appliedCharacterStyle = "none report";
     }
    

    {
     table.rows[0].cells.appliedCharacterStyle = "none report";
     }
    

    Anyone know how I can do the following?

    1. Select any row (or column) and apply the character style

    2. Select the last line (regardless of the number of rows in the table) and apply the character style

    3. apply the character style to specific columns (with theexception of the cells of two albums)

    Thank you!

    Hello

    Change this line:

    table.columns[a].cells.itemByRange(2,-1).texts.everyItem().appliedCharacterStyle = "chart orange";
    

    for the first 2 rows in each column

    Jarek

  • Apply the character Style to a few characters in a paragraph

    Hey,.

    Me again - I feel like I'm dumber than a shoe trying to script InDesign

    I have a block of text with several paragraphs, which I am adding one by one.

    When adding these paragraphs, sometimes I need to apply a character style to some of the characters in the paragraph (I have the clues start and end of these characters to the text of the paragraph).

    Using the Guide of the script and the object reference, I cooked up this code below, but not only it doesn't seem to find the character style, she also told me the. itemByRange() is not a function...

    What's wrong?

    var line_styles = [{
        'start': 22,
        'end': 33,
        'style': 'Price - SKU'
    }];
    
    frame.contents += "\r" + line_text;
    frame.parentStory.paragraphs[-1].applyParagraphStyle(style);
    
    for ( var j = 0, k = line_styles.length; j < k; j++ ) {
        var char_style = doc.characterStyles.item(line_styles[j].style);
        frame.parentStory.paragraphs[-1].itemByRange(
            line_styles[j].start,
            line_styles[j].end
        ).applyCharacterStyle(char_style, true);
    }
    

    frame.parentStory.paragraphs[-1].itemByRange(...

    does not compute. "paragraphs [-1]" points to a single paragraph and is not an itemByRange method. You must think of sth like

    frame.parentStory.paragraphs[-1].characters.itemByRange(...

    (Have you used another programming language Javascript front?) A matter of concern for the future: pay attention to your statements 'var '. They do not follow the block scope, as they do in other languages, and therefore persisted in this notation is very likely to bite you back somewhere in the future. Summer, done this, released as well the hair).

  • Apply for a position in the character style

    Hello

    I am new to the script, I tried the below to find the Exhibitor code characters and apply character styles?  the code shows not all errors below. Can you someone please suggest the below code is correct or not?

    myDoc var = app.activeDocument;

    app.findTextPreferences.findWhat = NothingEnum.nothing;

    app.changeTextPreferences.changeTo = NothingEnum.nothing;

    app.findTextPreferences.position = Position.SUPERSCRIPT;

    app.changeTextPreferences.appliedCharacterStyle = 'exposing ';

    App.Documents.Item (0) .changeText ();

    app.findTextPreferences.position = Position.SUBSCRIPT;

    app.changeTextPreferences.appliedCharacterStyle = "index";

    App.Documents.Item (0) .changeText ();

    Kind regards

    Vinatier

    Strike fault! It should be:

    app.activeDocument.characterStyles.itemByName ("first");

  • How can I leave second column applied to the character style "ITALIC".

    Hello world

    Can you do a script for applied second text column applied to character style ITALIC

    Like this:

    UI035.jpg

    Thank you

    John

    Select the table and run the script below:

    App.Selection [0]. Columns [1]. Select();

    App.Selection [0].texts.everyItem () .appliedCharacterStyle = "ITALIC".

    Vandy

  • CS5: Hyperlink to anchor text in the character style?

    Is it possible to script the following:

    A text has several occurrences of the same string, for example "A10". One is marked with a character style "Anchor" and others are marked by a character style "link." The idea is to create anchors text style "Anchor" then find all occurrences of the character 'Link' style and create a hyperlink to the corresponding anchor.

    I managed to find a script that creates a character style "Anchor" text anchors Can anyone offer suggestions on how to make script creating the links?

    Written by Kasyan Servetsky

    March 13, 2011

    // http://www.Kasyan.HO.com.UA

    / / e-mail: [email protected]

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

    If (app.documents.length == 0) ErrorExit ("Please open a document and try again.");

    const gScriptName = "create anchor text."

    const gScriptVersion = "1.0";

    gDoc var = app.activeDocument;

    If (! gDoc.characterStyles.item("Anchor").isValid) ErrorExit ("Character style \"Anchor\"n'existe No.");

    CreateDestinations();

    //======================================================== FUNCTIONS  =====================================================

    function CreateDestinations() {}

    app.findGrepPreferences = app.changeGrepPreferences = NothingEnum.nothing;

    app.findGrepPreferences.findWhat = '. '. + » ;

    app.findGrepPreferences.appliedCharacterStyle = gDoc.characterStyles.item ("Anchor");

    var found = gDoc.findGrep ();

    var destCounter = 0;

    for (var j = finds.length - 1; j > = 0; j-) {}

    var found = found [j];

    try {}

    If (! gDoc.hyperlinkTextDestinations.itemByName (found.contents) .isValid) {}

    var hypTextDest = gDoc.hyperlinkTextDestinations.add (found);

    hypTextDest.name = found.contents;

    destCounter ++;

    }

    }

    {catch (e)}

    }

    If (destCounter == 0) {}

    Alert ("no anchor text were created.", gScriptName + "-" + gScriptVersion);

    }

    Else if (destCounter == 1) {}

    Alert ("a text anchor is created.", gScriptName + "-" + gScriptVersion);

    }

    ElseIf (destCounter > 1) {}

    Alert (destCounter "text anchors have been created.", gScriptName + "-" + gScriptVersion);

    }

    }

    //---------------------------------------------------------------------------------------- ----------------------------------------------------------------

    function ErrorExit (error, icon) {}

    warning (error, gScriptName + "-" + gScriptVersion, icon);

    Exit();

    }

    //---------------------------------------------------------------------------------------- ----------------------------------------------------------------

    Hello

    The path is:

    create a hyperlinkTextDestination;

    create a hyperlinkTextSources;

    Create hyperlinks using a single destination and sources;

    so:

    // to create hyperlinks alike:    one destination==>many sources
    // destination is the 1st occurrence of text with charStyle "anchor" applied
    // sources are each occurrences of text with charStyle "link" applied
    
    var mDoc = app.activeDocument;
    
    app.findTextPreferences = app.changeTextPreferences = NothingEnum.nothing;
    app.findTextPreferences.appliedCharacterStyle = mDoc.characterStyles.item("anchor");
    
    var
         mAnchor = mDoc.findText()[0],
         mDest;
    
    if (mAnchor) mDest = mDoc.hyperlinkTextDestinations.add(mAnchor,{name: mAnchor.words[0].contents});
    else {alert ("no anchor found"); exit(); }
    
    app.findTextPreferences.appliedCharacterStyle = mDoc.characterStyles.item("link");
    
    var
         mSource = mDoc.findText(),
         len = mSource.length,
         currSource, currHyper;
    
    if (!len) {alert ("no link found"); exit(); }
    
    while (len-->0) {
         currSource = mDoc.hyperlinkTextSources.add(mSource[len],{name: "sourceLink_" + len});
         currHyper = mDoc.hyperlinks.add(currSource, mDest, {name: "mHyperlink_" + mDest.name + "_" + len});
         }
    
    app.findTextPreferences = app.changeTextPreferences = NothingEnum.nothing;
    

    Jarek

  • Select the character style [no]

    Hi all

    Is there a javascript something simple that would choose character style [no]? (no paragraph)

    whenever I open the Indesign document, there is a specific style (when the document has been saved) and it is white in color that won't work for me. So I was wondering a simple script to reset the style [None]

    Thank you

    Hi Dawid,

    Please try the JS code below.

    app.activeDocument.textDefaults.appliedParagraphStyle = app.activeDocument.paragraphStyles.item ("[Basic Paragraph]");
    app.activeDocument.textDefaults.appliedCharacterStyle = app.activeDocument.characterStyles.item ("[None]");
    

    THX,

    csm_phil

  • Is it possible to add text to the cells and apply the character style in the cell

    I work in InDesign on Mac 5.

    I have two tables of formatting with information that will be eventually combined. I implemented the scripts I found on these forums to add the columns needed, merge lines and fill the cells merged with the appropriate color, but can't two remaining tasks.

    1. is it possible to add text to a cell of some?

    2 and it is possible to apply a character style to cells? (different cells than those that I need to add some text)

    I played with this code but do not know if it is even close...

    {

    table. Rows [0]. Cells [0]. InsertText (' CS/PS");

    }

    {

    table. Rows [0]. Cells [0] .appliedCharacterStyle ("bold");

    }

    Here are the scripts that I have combined so far for the table...

    Add column

    myTable = app.selection [0];

    MyColumn = myTable.columns [1];

    for (a = 0; < 1; a ++)

    {

    myTable.columns.add (LocationOptions.AFTER, myColumn);

    }

    Merge lines

    table = app.selection [0];

    If (table.hasOwnProperty ("baseline") table) = table.parent;

    If (instanceof cell table) table = table.parent;

    If (instanceof column table) table = table.parent;

    If (instanceof row table) table = table.parent;

    If (instanceof Table table)

    {

    table. Rows [0]. Cells [0]. Merge (table.rows [0] .cells [1]);

    }

    {

    colours alternating in merged lines

    r = table.rows [1];

    n = app.activeDocument.swatches.item ("orange");

    b = app.activeDocument.swatches.item ("PANTONE 3005 C");

    for (c = 0; c < r.cells.length; c ++)

    {

    If (c & 1)

    r.Cells [c]. Properties = {fillColor:b};

    on the other

    r.Cells [c]. FillColor = n;

    }

    }

    Hello

    1. If you want to add the text, go further in:

    table. Rows [0]. Cells [0] .insertionPoints [0] .silence = ' CS/PS;

    2 similar with application of styles:

    table. Rows [0]. Cells [0] .texts [0] .appliedCharacterStyle = "bold" / / If this style is present in your doc

    Jarek

  • How to apply the character style to table cell

    I'm sure it's basic, but I can't find any references on how to do it and my attempts have failed.  I use VB and CS5.5

    Basically what I'm trying to do is to select a table cell and apply a character like this style...

    MyCharacterStyle = myDocument.CharacterStyles.Add set

    myCharacterStyle.Name = "TH2".

    myTable2.Cells.Item (1) .appliedCharacterStyle = "TH2".

    with this code, I get a "object does not support this property or method.  myTable2.Cells.Item (...). appliedCharacterStyle ".

    I tried several other versions without success.

    Can someone tell me what would be the proper syntax to apply a character style to text in a table cell, or if it's still the right path to follow on that?

    I have to select the text in the cell rather than the cell itself, and if so, how do you do that?

    Thank you

    You do not need to select the text in the cell, but you need

    to target rather than the cell. It is true that in the user interface, you can

    Select the cell and apply a style of tank, but not with a script. Thus, in

    JavaScript is:

    myCell.texts.item (0) = .appliedCharacterStyle

    app.activeDocument.characterStyles.itemByName ("MyCharStyleName")

    It must be something similar in VB also.

    Of course, you can target the text in different ways:

    myCell.characters.everyItem () or myCell.paragraphs.everyItem () etc etc.

    but I think that the text is the most basic of the lot.

    Ariel

  • CS3: GREP find/change with the character Style?

    Hello

    Was surfing autour through various resources, but have not been able to understand how / if possible...

    Basically, all along of a wide catalogue, there are a lot of situations with lines of text like this:

    CF2 = Double caramel icing

    and I want to look for this string and apply a character style to just the "CF2" who will be "BOLD".

    Is this possible?

    Thank you!

    Andrew

    Search

    \bCF2 (? == double caramel icing)

    Put your character style "BOLD" in the field of formatting to replace.

    Change all.

Maybe you are looking for