Text variable & character style

Is it possible to make a character style part of the definition of a text variable?

I see the problem, can't think of anything off-hand... Your idea
Find/Change could be used to search for a variable
has its own set of limitation. Other than you'd expect, Find/Change cannot search for any variable of choice -- rather, you can only distinguish between the different types of variables. If your product name is a Custom Text variable, the Find/Change will work but it will pick up all custom text vars.
Yes, still plenty room for improvements

Similar Messages

  • [AS][CS3] Finding text with character style

    Please help to tell me how to find text with a specific character style and then delete the text.
    I had no problem doing this with CS2 but its doing my head in now.
    Thanks,
    Andrew

    Here you go. This assumes that your character style is at the top level of the panel. If you're using style groups, you'll need to write code to get at the style you want to use.
    //DESCRIPTION: Delete text in named character style
    (function() {
      if (app.documents.length > 0) {
        deleteStyledText(app.documents[0]);
      function deleteStyledText(aDoc) {
        var cStyle = aDoc.characterStyles.item("CharStyleName");
        setupFindText();
        app.findTextPreferences.appliedCharacterStyle = cStyle;
        aDoc.changeText();
      function setupFindText(find, change, wholeWd, caseSense, foots, hidLayers, lockedLayers, lockedStories, masters) {
        app.findTextPreferences = null;
        app.changeTextPreferences = null;
        try { app.findTextPreferences.findWhat = find } catch(e) {};
        try {app.changeTextPreferences.changeTo = change } catch(e) {};
        app.findChangeTextOptions.properties = {
          caseSensitive:(caseSense == null ? false : caseSense),
          wholeWord:(wholeWd == null ? false : wholeWd),
          includeFootnotes:(foots == null ? false : foots),
          includeHiddenLayers:(hidLayers == null ? false : hidLayers),
          includeLockedLayersForFind:(lockedLayers == null ? false : lockedLayers),
          includeLockedStoriesForFind:(lockedStories == null ? false : lockedStories),
          includeMasterPages:(masters == null ? false : masters)
      } // end setupFindText
    Dave

  • Having a problem with character styles in indesign

    I'm having another problem with my style sheets in indesign, I've now got an awful lot of styles in paragraph and character styles. I've created different styles for paragraph justified text and when I go to my style in paragraph styles to use tight text copy, character styles always overides it so it means I have to do  whole lot of extra formatting just to put it right. Does anyone have an idea how I can stop character styles overiding paragraph styles? Thanks very much.

    Perhaps your character styles apply more than you actually want? I.e., rather than just "+Italic" it also applies custom tracking. You should use character styles only to override the stuff you really want to change.
    You can check by calling up the definition for those character styles; the huge "Style Settings" text box lists all the attributes it changes.

  • InDesign crash while applying character style

    Hi all,
    A)I have problem with applying character style to selected text.
    when character style is applied to selected text indesign get crashes.
    my code snippet is as follow
    input parameters
    1.RangeData paraRange // start and end index of paragraph
    2.storyUIDRef // uidref of current story
              code snippet
              // valid text model
              InterfacePtr<ITextModel> textModel(storyUIDRef, UseDefaultIID());
              if (!textModel)
       break;
              //wax strand
              InterfacePtr<IWaxStrand> waxStrand(((IWaxStrand*)textModel->QueryStrand(kFrameListBoss, IID_IWAXSTRAND)));
              if (waxStrand == nil)
       break;
              //WaxIterator
              K2::scoped_ptr<IWaxIterator> waxIterator(waxStrand->NewWaxIterator());
              if (waxIterator == nil)
        break;
              //first wax line of paragraph
              IWaxLine* waxLine = waxIterator->GetFirstWaxLine(paraRange.Start(nil));
              //iterate each waxline
              while (waxLine != nil && (waxLine->TextOrigin() < paraRange.End()))
        //Iterate for all runs
       K2::scoped_ptr<IWaxRunIterator> waxRunIter( waxLine->QueryWaxRunIterator() ) ;
       IWaxRun * waxRun = waxRunIter->GetFirstRun();
       while (waxRun)
       int32 startPos  = waxRun->TextOrigin();
       int32 endPos = startPos + waxRun->GetCharCount();
       RangeData textRange(startPos ,endPos);
       ISelectionManager* selMgr = m_activeContext->GetContextSelection();
       if(!selMgr)
        break;
       //get valid textselection suite
      InterfacePtr<ITextSelectionSuite> suite(selMgr, UseDefaultIID());
                                  if (!suite)
       break;
                                  //select  text
      suite->SetTextSelection(storyRef, textRange, Selection::kScrollIntoView, nil);
                                  //created style from selection using  " SnpManipulate::TextStyleCreateStyleFromSelection" method.
    my code get crashed at highlighted text( int32 startPos  = waxRun->TextOrigin();).
    B)my next question is how to get textstyle ranges of a selected paragraph.
    please help me.
    Thanks
    Tahir

    A) Make sure that the all parcels of the text is composed before you iterate it, see ITextParcelListComposer. I don't quite understand what you are trying to achieve. You want to apply a character style to a range of text, but the code iterates wax lines and iterate the runs of each line  and sets the current selection to be the run on each iteration. Why not just:
    InterfacePtr<ICommand> icmd(textmodelCmds->ApplyStyleCmd(index, length,styleUID,kCharAttrStrandBoss,kFalse));
    B) Walk the kCharAttrStrands to the get information:
    InterfacePtr<IStrand> strand((IStrand*)textmodel->QueryStrand(kCharAttrStrandBoss,IStrand::kDefaultIID));
    then call stand->GetRunLength() a number of times until, you are through the selected part of the text / paragraph

  • URL from Character Style

    I am trying to figure out how to create a script of some kind (apple or java) that will search a document for any instance of a character style and turn that into a URL. If this has been posted before does anyone know where? I searched but can't find anything.
    Any help or guidance would be appreciated. I am using CS3 on MAC.
    Thanks

    Hi,<br />//Assuming your character styles is called "web"<br />//In other cases, replace web by your own predefinite name<br /><br />var doc=app.activeDocument;<br />//Define find text preferences as text using character style called "web"<br /><br />app.findTextPreferences.appliedCharacterStyle=doc.characterStyles.item("web");<br /><br />//Find text occurences that match the preference<br /><br />var found = app.findText();<br /><br />//Add hyperlinks to the occurences<br /><br />for(i=0; i<found.length; i++)<br />{<br /><br />//Replace Yahoo.fr by your desired website<br />     <br />var dest=doc.hyperlinkURLDestinations.add("http://www.yahoo.fr");<br />     <br />var source = doc.hyperlinkTextSources.add(found[i]);<br />     <br />var dest=doc.hyperlinkURLDestinations.add("http://www.yahoo.fr");<br />     <br />doc.hyperlinks.add(source,dest, {visible:false, name:"yahoo.fr ("+(i+1)+")"});<br /><br />}<br />//If you want to export your doc as a interactive document, don't forget to set add hyperlinks to true or they won't be active in your pdf.<br />Loic

  • Find character styles

    Hi,
    How to find character styles through javascript

    finding text using character style means the below code will do that...
    app.findGrepPreferences = app.changeGrepPreferences = null;
    app.findGrepPreferences.appliedCharacterStyle = "char_style";//character style name
    found = app.activeDocument.findGrep (true);
    for (i = 0; i < found.length; i++){
        found[i].select();
    app.findGrepPreferences = app.changeGrepPreferences = null;
    Vandy

  • Why do text variables using Running Header character style translate forced returns as a word space in the running head on the first page but close up the space on subsequent pages?

    In an InDesign document that requires 3 different Chapter head paragraph styles (to cope with differrent length headings) I've set up the running heads on the master page with a text variable using the Running header (character style) option. The character style I've assigned to this is an empty character style that is applied to all 3 chapter head paragraph styles.
    Some chapter heads require a forced line break, so that the line breaks are aethesically pleasing. On the first page the text variable translates this forced line break as a word space in the running head, but on subsequent pages it ignores the forced line break. This means that if you have a word space before the forced line break, on the first page you get a double word space and on subsequent pages the running head sets correctly with a single word space. But if you remove the word space before the forced line break in the chapter head text, the first running head sets correctly with forced line break interpreted as a single word space, but on subsequest pages the space is closed up.
    This only seems to be a problem when the character style option is used for header text variables. If a paragraph style is used the forrced line break is interpreted as a a single word space in all instances, both on the foirst page and subsequent pages.
    This would appear to be a bug in how text variables are applied when using the Running header (character style) option. I can't see any other reason why the text variable would beheave differently on the first page and on subsequent pages. There is only one master page, so it isn't a case of their being an error between a main master page and a chapter opener master page.
    Does anyone have any solutionss, or know if this problem has been fixed in subsequent releases of InDesign (I'm using CS6 ID version 8.0)
    Thanks

    Ask in the ID forum...
    Mylenium

  • Is there a way to allow for two lines in "running header (character style)" text variable?

    In my "running header (character style)" text variables, some of the items are quite long and take up more space in my header than I have room for - because I have another "running header (character style)" text variable beside it - and I am trying to figure out if there is a way to force that text variable to go into two lines when it runs out of space.
    Does anyone know if this is possible?

    Sadly, only by adding a forced line break in the variable. Adobe’s engineers are unable to allow long variables to break at the end of a line. Sad, since this is a feature I remember from a Macintosh word processor I used in 1988.

  • How can I apply a GREP style to a text variable?

    Hello everybody,
    I have a question concerning GREP styles inside Paragraph styles.
    1. I've created a text variable to generate a recurring title on the upper side of the page based on the main title paragraph style;
    2. The recurring title is in Adobe Garamond Small Caps, all letters in lower case, and it is formatted with a paragraph style sheet in the master page;
    3. I want to create a GREP style for the recurring title, according to which every time that in the recurring title appear an apostrophe or the double quotes, they are automatically lowered 2pt on the baseline
    (I already created the character style sheet that lowers letters of 2pt).
    What I need is the correct GREP formula to automatically apply the character style sheet to apostrophes and double quotes, in the line of text generated by the text variable...
    Thanks for your  help
    p.

    Hi,
    As I said, using Power Headers is the best way to do it.
    As Power Headers treats the header as "live text", you can use a simple grep style inserted in the header para style:
    … to obtain:
    For the sample, I use a char style named "-2pts" with Shift -5 pts and Green color to show you the place of ' and ".
    Don't forget that, even Power Headers treats the header as "live text", you only have to update Power Headers to make an update of the headers! 
    Even I use in another cases Tomaxxi's [JS] and it's a good way to treat the question, Jean-Claude Tremblay's solution is less interesting because the variable used is converted in text. If the variable text content changes, it's more complicated to manage the update!

  • How to make a text variable (running header - character) resize a text frame?

    I have successfully been able to get a metadata text variable to auto-resize a text frame, but when I change the text variable to a running header-character/paragraph variable, the text frame does not resize - in fact it gets smaller and squashes the text.
    Surely if Indesign can handle one kind of variable it should handle another??
    Please help!

    Thanks all.
    Will- I tried adding another character to the text box but this made no difference.
    Eugene- I'm trying to avoid the purchase of any 3rd party plugins due to budget constraints.
    I realised that all I needed to do was use a wide paragraph rule to emulate a box behind the text, and make the text box long enough to hold all possible variables.
    One other issue has now cropped up, the running header (character) only grabs the text up to the first return, but I need it to grab all text formatted with the Character Style (2-3 lines max).
    I require a forced line break in the title (where the header is being pulled from) as it has a paragraph rule style attached, requiring a full return for each line of the title.
    Any ideas?

  • Cross references not picking up character styles in source text

    I'm getting some annoying odd behaviour with cross references in Frame 12.
    I have some tables, where the paragraph style in the cell is called "Cell Body" (nothing odd there).
    Quite a few of the cells only have one word in them, and that word is set to courier font with a character style (called "Code").
    Then, elsewhere in the document, I am referring to this text using cross references. I am referencing the paragraph style Cell Body, and the cross reference format applied is like this "<hyperlink><$paratext><Default ¶ Font>"
    "hyperlink" is another character style that makes the text go green.
    So, the cross reference out to take the text from the cell (in Courier) and reproduce it, coloured green.
    However for about half of these cross references, it isn't picking up the Code character style in the source text, so the cross ref is just green, no green courier.
    Things are further bamboozled when I output to HTML Help.
    In the CHM file, the cross refs which appear to work OK (green courier) are now just courier.
    The ones which failed to pick up the courier look the same as they do in Frame (just green).
    Any ideas as to what's going on?
    I've tried troubleshooting by clearing the cells, reapplying the para style and default character style, then reapplying the code character style, then replacing the cross reference - which sometimes seemed to fix it but didn't always.

    Arnis Gubins wrote:
    Using two character tags in-line together (a la <hyperlink><Code>) is asking for trouble. IIRC, FM doesn't re-apply these in order on an update and depending upon how they are defined (and what is set to AsIs), the outer one usually wins. .
    So why does the blimmin' dialog invite me to do precisely that, by providing me with a list of all the character styles I have, and allowing me to select as many of them as I like??? /sulks/   Indeed, if Frame still shipped with a printed user guide instead of  stupid "optimised for viewing on iPhones" online webhelp nonsense, I suspect I might very well be able to find an example in the manual of using multiple character styles in that dialog!  If it doesn't want you to use more than one, why doesn't it grey out after you add the first one? /sighs/  The concept is called "cascading styles", it's a fundamental web paradigm! And it works in the main body text - why not in Xrefs!
    Also, I have been very scrupulous to keep my character styles orthogonal so none of their AsIs's mash each other up.
    But, rant over, I shall follow your splendid suggestion for a "Code Hyperlink" style.
    Arnis Gubins wrote:
    Also, x-ref formatting may behave differently in the new Publishing modules depending upon ....
    ...Depending on how badly designed and buggy this new Frame12 feature is, I should say!   The Publish module should not randomly stop behaving in a WYSIWIG manner in completely undocumented fashion just because Adobe couldn't be bothered to code it properly.  /sighs/
    Frankly, for my current project, I've given up trying to jump through hoops for Publish - I'm concentrating on getting the Frame source right and assuming these quirks will be fixed in Frame 13 (or 14, depending on how superstitious they are). Because if I put in ad hoc workarounds for them in Frame 12, I (or a colleague) will only have to undo them later when they're fixed, and by then we'll all have forgotten what the original problem was.

  • InDesign erroneously applies character style to imported text

    For a year, I had been importing text into InDesign with little trouble until this problem starting happening and I can't figure out why.
    Let's say I have a CS3 file with defined character and paragraph styles.
    If I draw an empty text box, InDesign shows the character style "superscript" and paragraph style "ext_all" are applied. I can select "Break Link to Style," but if I import text into that box, the "superscript" character style is applied.
    The following happens whether I create a text box first or not:
    If I import a styled Word file, all the text comes in styled "superscript" until it reaches a Word character style.
    If I import an InDesign Tagged Text file, all the text comes in styled "superscript" until it reaches a character tag.
    If I import a very simple one sentence rtf file, all the text is styled "superscript."
    Anyone run into this? I've tried googling, but can't find a discussion about it. Thanks in advance!

    Perhaps you've inadvertently set those styles as the defaults? That would happen if you click on them with nothing selected. For the current document switch to the text tool and make sure there is no cursor active or text frame selected, then check to see that the character style is set to [None] and the paragraph style to what you would like to be your default. Also check the settings in the character and paragraph panels.
    To make sure this doesn't carry forward into any more new documents, if indeed that was the problem, close all documents and repeat the above steps. With no documents open your selections will become the defaults for all new work until changed.
    Peter

  • How do I apply a specific character style to specific text?

    Long-time Photoshop and Illustrator user. New to Indesign.
    Fortunately, this isn't an issue of how to go about creating fractions. I've already chosen a route for that. I'm simply applying a Character Style that checks the opentype "fractions" box.
    Here's an example of the content I'm dealing with:
    Above is my styled table in Indesign, after pasting in data I'm being given data in excel spreadsheets.
    How might I quickly apply my "ptable_BODY FRACTIONS" style to only certain text, like: "1/2"  +  "1/4"  +  "1/8"  & preferably random arbitrary fractions like "34/69"?
    GREP can do some great things, but can it selectively apply character styles?
    This might be a job for a paragraph style. I'm not sure.  . .

    @ John
    That's exactly what the GREP Styles feature does. Arriving at a GREP expression that accurately targets your fractions may be another matter considering your screen shot shows your content to have no space between whole numbers and fractions.
    Right. It keeps including the whole number preceding the fraction.
    I'm dead set on there not being a space between the whole number and fraction, too.
    I'm trying to figure out how to tell Indesign to take all fractions and give them opentype fractions settings.
    I'll only be dealing with standard fractions I'm hoping, so arbitrary fractions shouldn't be necessary.
    Just halves, quarters, eighths, and sixteenths should be ok. These are likely the only fractions I'll ever need to deal with: 1/2, 1/4, 3/4, 1/8, 3/8, 5/8, 7/8, 1/16, 3/16, 5/16, 7/16, 9/16, 11/16, 13/16, 15/16.

  • CS5: Hyperlink to text anchor from character style?

    Is it possible to script the following:
    A text has several occurances of the same string, e.g. 'A10'. One is marked with a character style 'Anchor' and the others are marked with a character style 'Link'. The idea is to create text anchors from the 'Anchor' style and then find every occurrence of the character style 'Link' and create a hyperlink to the matching anchor.
    I've managed to find a script that creates text anchors from a character style 'Anchor'. Can someone offer some suggestions on how to do 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 Text Anchors";
    const gScriptVersion = "1.0";
    var gDoc = app.activeDocument;
    if (!gDoc.characterStyles.item("Anchor").isValid) ErrorExit("Character style \"Anchor\" doesn't exist.");
    CreateDestinations();
    //======================================================== FUNCTIONS  =====================================================
    function CreateDestinations() {
        app.findGrepPreferences = app.changeGrepPreferences = NothingEnum.nothing;
        app.findGrepPreferences.findWhat = ".+";
        app.findGrepPreferences.appliedCharacterStyle = gDoc.characterStyles.item("Anchor");
        var finds = gDoc.findGrep();
        var destCounter = 0;
        for ( var j = finds.length-1; j >= 0; j-- ) {
            var found = finds[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 text anchors have been created.", gScriptName + " - " + gScriptVersion);
        else if (destCounter == 1) {
            alert("One text anchor has been created.", gScriptName + " - " + gScriptVersion);
        else if (destCounter > 1) {
            alert(destCounter  + " text anchors have been created.", gScriptName + " - " + gScriptVersion);
    function ErrorExit(error, icon) {
        alert(error, gScriptName + " - " + gScriptVersion, icon);
        exit();

    Hi,
    The way is:
    create hyperlinkTextDestination;
    create hyperlinkTextSources;
    create hyperlinks using one destination and various 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

  • [AS-CS5] Comparison between text style range and character style

    Hi,
    It's been a while since I'm not coming on this forum ...
    I'm looking to make a comparison between a "text style range" and a character style.
    I have no problems, except for the comparison of "fonts".
    myCurrentText = text for char…
    theStyle = character style id…
    I try:
           if (applied font of myCurrentText ≠ applied font of theStyle) then set theCharDifference to 1 
    The selected text give me:
           font "Minion Pro        Italic" of application "Adobe InDesign CS5.5"
    and the character style:
           "Minion Pro"
    I try "set theTextFont to font of applied font of myCurrentText" -> Error
    This is my script (it's too long to post here) <http://db.tt/BLoGPiN>.
    Loot at the "on CheckCharacterDifference(myCurrentText, theStyle)"
    TIA.
    Oli.

    I've written this, but I do not know if it covers all cases ...
    Someone?
    Thanks.
    Oli.
    set theText to item 1 of selection
    set theStyleChar to properties of character style 2
    -- analysis of the properties of the text
    set myTextFontApplied to applied font of theText
    set myTextFontFamily to font family of applied font of theText
    set myTextFontStyle to font style of theText
    -- analysis of the character style
    set myStyleCharFontStyle to applied font of theStyleChar
    if myStyleCharFontStyle = "" then
         set myStyleCharFontStyle to font style of theStyleChar
         if myStyleCharFontStyle ≠ myTextFontStyle then set theDifference to true
    else
         if myStyleCharFontStyle ≠ myTextFontFamily then set theDifference to true
    end if
    Message was edited by: OlivierBerquin

Maybe you are looking for

  • IPhone 5S annoying issue

    Hi everyone I am really sad about Apple's iOS 7, which I am really angry about some bugs. I'm using iOS 7.0.4 on my iPhone 5S 64 GB, and I had 2 big issues: 1- When I go to Voice Memos, it takes about 10 seconds to load, and when it loads, when you t

  • How Do I Connect ATV to DLP TV w/o HDMI

    I recently purchased an Apple TV (2nd GEN) for my parents for Christmas, only to find out that there DLP TV does not have an HDMI input. The TV is an HDTV and does support 720p but I have searched around the web to see if anything is possible to purc

  • WRE54G doesn't work with PS3...

    Hello, I bought yesterday the range expander WRE54G because I would like to expand my WiFi singal and make it accesible to my PS3. I configured de range expander and it works fine with all my electronic gadgets with WiFi, but it doesn't work with PS3

  • Excluding result of one report in another report.

    Hell Experts, We have two DSOs as below: DSO1 - Contains Master list of customers DSO2 - Transactions of all customer. I want a report to show all customers who do not have any transactions. So thought of come up with all unique set of customers from

  • Emulator suddenly stopped working

    Hi, recently I have encountered problem with emulator suddenly stopped working. I am using linux (Mandriva 2009.1), WTK 2.5.2_01 and Eclipse 3.5. The only thing I am getting is message "Running with storage root ~/j2mewtk/2.5.2/appdb/temp.DefaultColo