TextLayoutcase - SmallCaps

One of the features that caught my attention with the new text engine has the TypographicCase you are able to put on the text. With the TextLayout component so I decided to give it a try, but I did not what I expected.

When I put the case of "High" or "Low", I get the results I expect. I put the case to "SmallCaps", and the text does not change. Small capitals should be the first letter of the word be capitalized and the remaining characters be a size smaller capital character, example: http://en.wikipedia.org/wiki/Small_caps.

Some fonts don't support SmallCaps? I tried many (but not all) fonts and get the same result.
I have to do something different to get the SmallCaps to work?
Not the new TextEngine does not support my idea of SmallCaps?

Thank you!

Well, it looks that I was confused. The definitions of the TypographicCase values that we are correct according to the OpenType specification for relevant tags.

SMALL_CAPS only changes capital letters to small caps (c2sc) glyphs
CAPS_AND_SMALL_CAPS only changes the lowercase letters to small caps (smcp) glyphs

The latter is what you are looking for. It is the most common use of small capitals, I know, but it usually goes by the name of the former.

What we are in default is a value which applies the two tags and modifies all the glyphs in small capitals. To do this, I put in a request.

Tags: Adobe Open Source

Similar Questions

  • Does anyone know how to make SmallCaps off a police in Muse?

    I use Palatino and would like to make SmallCaps and Italic SmallCaps.

    Does anyone know how to proceed in Muse?

    Thank you very much for the help.

    Hello

    Update: Adobe Muse CC 20141 (published earlier today) includes support for web fonts self-hosted. To use a specific font in your Muse site, you will need to install the font system (an appropriate license to use desktop) and provide the files to corresponding web fonts (a license appropriate for use on a Web site).

    Try it and tell us if you need help or have problems.

    Abhishek

  • Execution script

    Hello Experts,

    Here is the code I use to alert generated machine small cap found in the document or not.

    This will give warning that if I run the script. Is it possible to make a panel who run this script in the backend and show the results via javascript? (like the preflight Panel)

    I hope that this can be done by the plugin. But he must know is possible to do the same in javascript.

    var myDoc = app.activeDocument;
    app.findTextPreferences = NothingEnum.nothing;
    app.changeTextPreferences = NothingEnum.nothing;
    app.findTextPreferences.capitalization = Capitalization.SMALL_CAPS;
    var myFinds = myDoc.findText();
    app.findTextPreferences = NothingEnum.nothing;
    app.changeTextPreferences = NothingEnum.nothing;
    if (myFinds.length == 0) {
       alert("No Small Caps found");
    }
    else {
      alert("Small Caps found");  
    }
    

    Thanks in advance.

    Kitty

    // VERY VERY VERY ROUGH STARTER GUIDE
    // add checks and optimizations yourself!
    
    #targetengine smallcaps
    (function () {
    // just for debug purposes remove the eventListeners if they exist and add them again
    // for release check if they exist and create them of if they don't
        app.eventListeners.item("onAfterDocSmallCaps").isValid && app.eventListeners.item("onAfterDocSmallCaps").remove();
        app.eventListeners.item("onSelectionChange").isValid && app.eventListeners.item("onSelectionChange").remove();
        app.eventListeners.item("afterSelectionChanged").isValid && app.eventListeners.item("afterSelectionChanged").remove();
        app.eventListeners.add("afterOpen", checkForSmallCaps).name = "onAfterDocSmallCaps";
        app.eventListeners.add("afterSelectionAttributeChanged", checkForSmallCaps).name = "onSelectionChange";
        app.eventListeners.add("afterSelectionChanged", checkForSmallCaps).name = "afterSelectionChanged";
        const capMessage = ["No Small Caps", "Yes Small Caps"];
        var scui = new Window('palette');
        scui.caps = scui.add('staticText');
        scui.caps.minimumSize.width = 200;
        scui.show();
    
        function updateUI(yep) {
            if (updateUI.cache === yep) return;
            updateUI.cache = yep;
            scui.caps.text = capMessage[yep];
        }
    
        function checkForSmallCaps(ev){
            var sel = app.selection;
            if (sel.length) {
                sel = sel[0];
                if (sel.properties.baseline) {
                    updateUI(+(sel.capitalization == +Capitalization.SMALL_CAPS));
                }
    
            }
        }
    })();
    
  • Find without small caps italic and apply cstyle

    Hi all

    I have small capitals (nested) line with italic text (see the screenshot), I tried to apply the italic "small caps" style of characters successfully. After that I will apply the cstyle "small caps" to the text of the CAP as small, but my script works does not, can you if you please correct it.

    itals var = ["italic", "Light Italic", "LightItalic', 'Italic book', 'Cursive', 'Light Condensed Italic',"Book Condensed Italic","Ultra Condensed Italic","Ultra Italic","Condensed Italic", 'ThinItalic', 'BookItalic', 'LightItalic', 'BookItalic', 'UltraItalic']

    SmallCaps = var ["small capitals and old figures", "55Roman small capitals and old figures", "smallCaps"];

    Fix_All_SmallCaps_Italic()

    function Fix_All_SmallCaps_Italic()

    {

    Try

    {

    var myCStyle7 = app.activeDocument.characterStyles.item("15_Small_Caps_Italic").name;

    }

    catch (MyError)

    {

    var myCStyle7 = app.activeDocument.characterStyles.add ({name: "15 small caps italic", capitalization: Capitalization.SMALL_CAPS, fontStyle: "Italic" "})

    }

    for (i = 0; i < itals.length; i ++)

    {

    app.findTextPreferences = app.changeTextPreferences = NothingEnum.nothing;

    app.findTextPreferences.fontStyle = itals [i];

    app.findTextPreferences.capitalization = Capitalization.SMALL_CAPS;

    app.changeTextPreferences.appliedCharacterStyle = "15 small caps italic";

    app.activeDocument.changeText ();

    }

    }

    ~ exit (0);

    Fix_All_SmallCaps();

    function Fix_All_SmallCaps()

    {

    Try

    {

    var myCStyle6 = app.activeDocument.characterStyles.item("15_Small_Caps").name;

    }

    catch (MyError)

    {

    var myCStyle6 = app.activeDocument.characterStyles.add ({name: "15 small capitals", capitalization: Capitalization.SMALL_CAPS})

    }

    for (sc = 0; sc < smallCaps.length; sc ++)

    {

    app.findTextPreferences = app.changeTextPreferences = NothingEnum.nothing;

    app.findTextPreferences.fontStyle = smallCaps [sc];

    app.changeTextPreferences.appliedCharacterStyle = "15 small capitals;

    app.activeDocument.changeText ();

    }

    find the attribute and apply the character style

    myDoc var = app.activeDocument;

    mcstyle var = app.activeDocument.characterStyles.item("15_Small_Caps_Italic").name;

    app.findTextPreferences = app.changeTextPreferences = null;

    app.findTextPreferences.capitalization = Capitalization.SMALL_CAPS;

    app.changeTextPreferences.appliedCharacterStyle = "15 small capitals;

    var myFind = myDoc.findText ();

    for (var j = 0; j < myFind.length; j ++) {}

    If (. appliedCharacterStyle.name myFind [j] == mcstyle) {}

    Alert (myFind [j]. Happy)

    continue;

    }

    ElseIf (. appliedCharacterStyle.name myFind [j]! = mcstyle) {}

    app.activeDocument.changeText () ;}

    }

    }

    Screen shot 2015-03-05 at 5.34.11 PM.png

    Hello

    1. If your charStyles only has names?

    2. maybe disable this line:

    app.findTextPreferences.fontStyle = itals [i]

    so myFind table will match smallCaps all.

    Now to browse and use the switch... case loop

    I mean:

    //...
    switch (myFind[j].fontStyle) {
        case "Italic":
        case "Light Italic":
        case "LightItalic":
        case "Book Italic":
        case "Coursive":
              myFind[j].appliedCharacterStyle = myCStyle7;
              break;
        default:
              myFind[j].appliedCharacterStyle = myCStyle6;
              break;
        }
    //...
    

    Jarek

    (Changed; switch (myFind [j] .fontStyle))

  • Fix my script

    Hello

    His operation but "Default setting for advanced Type" value is not updated in my Indesign file. Pls fix my script.

    var w = new Window ("dialog", "Template Checklist", undefined, {closeButton: false});
    w.alignChildren = "left";
    var check1  = w.add ("checkbox", undefined, "Preference settings");
    
    
       if (check1.value == true)
     {
        //this is 'Advanced Type' default setting
        myDocument.viewPreferences.horizontalMeasurementUnits = MeasurementUnits.inches;
        myDocument.viewPreferences.verticalMeasurementUnits = MeasurementUnits.inches;
        myDocument.viewPreferences.rulerOrigin = RulerOrigin.pageOrigin;
        myDocument.textPreferences.superscriptPosition=33;
        myDocument.textPreferences.superscriptSize=70;
        myDocument.textPreferences.subscriptPosition=33;
        myDocument.textPreferences.subscriptSize=70;
        myDocument.textPreferences.smallCap=75;
        app.imePreferences.inlineInput=true;
        }
    var buttons = w.add ("group");
    buttons.add ("button", undefined, "Ok");
    buttons.add ("button", undefined, "Cancel");
    w.show ();
    var ProgressBar = function(/*str*/title)
    {
         var w = new Window('palette', ' '+title, {x:0, y:0, width:340, height:60}),
              pb = w.add('progressbar', {x:20, y:12, width:300, height:12}, 0, 100),
              st = w.add('statictext', {x:10, y:36, width:320, height:20}, '');
         st.justify = 'center';
         w.center();
         this.reset = function(msg,maxValue)
              {
              st.text = msg;
              pb.value = 0;
              pb.maxvalue = maxValue||0;
              pb.visible = !!maxValue;
              w.show();
              };
         this.hit = function() {++pb.value;};
         this.hide = function() {w.hide();};
         this.close = function() {w.close();};
    };
    //------------------------------------------------
    //      SAMPLE CODE
    //------------------------------------------------
    function main()
    {
         var pBar = new ProgressBar("Running");
         var i;
         
         // Routine #1
         pBar.reset("Please wait Processing ...", 100);
         for( i=0 ; i < 100; ++i, pBar.hit() )
              {
              $.sleep(10);
              }
         // Routine #2 
         pBar.close();
         }
    main();
    exit();
    

    Pls fix my script

    by

    hasvi

    Hi Hasvi,

    Corrected code.

    var w = new window ('dialog', 'List of model checking', undefined, {closeButton: false});

    w.alignChildren = 'left ';

    var check1 = w.add ('checkbox', undefined, 'Préférences');

    var buttons = w.add ("group");

    Buttons.Add ('button', undefined, 'Ok');

    Buttons.Add ('button', undefined, 'Cancel');

    w.Show ();

    myDocument var = app.activeDocument;

    If (check1.value is true)

    {

    It is by default "Advanced Type"

    myDocument.viewPreferences.horizontalMeasurementUnits = MeasurementUnits.inches;

    myDocument.viewPreferences.verticalMeasurementUnits = MeasurementUnits.inches;

    myDocument.viewPreferences.rulerOrigin = RulerOrigin.pageOrigin;

    myDocument.textPreferences.superscriptPosition = 33;

    myDocument.textPreferences.superscriptSize = 70;

    myDocument.textPreferences.subscriptPosition = 33;

    myDocument.textPreferences.subscriptSize = 70;

    myDocument.textPreferences.smallCap = 75;

    app.imePreferences.inlineInput = true;

    }

    var ProgressBar = function(/*str*/title)

    {

    var w = new window ("palette", "' + title, {x: 0, y: 0, width: 340, height: 60}").

    PB = w.add ("progressbar", {x: 20, y: 12, width: 300, height: 12}, 0, 100);

    St = w.add ("statictext', {x: 10, y: 36, width: 320, height: 20}," ");

    St.Justify = 'center ';

    w.Center ();

    This.Reset = function (msg, maxValue)

    {

    St.Text = msg;

    PB. Value = 0;

    PB. MaxValue = maxValue | 0;

    PB.visible =! maxValue;

    w.Show ();

    };

    This.hit = function() {++ pb.value ;};}

    This.Hide = function() {w.hide ;};)

    This.Close = function() {w.close ;};)

    };

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

    CODE EXAMPLE

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

    main() function

    {

    var pBar = new ProgressBar ("Running");

    var i;

    Routine #1

    pBar.reset ("wait PLEASE treatment... (', 100);

    for (i = 0; i< 100;="" ++i,="" pbar.hit()="">

    {

    $.sleep (10);

    }

    Routine #2

    pBar.close ();

    }

    main();

    Exit();

  • several findTextPreferences in a loop

    Hello

    I want to make multiple discoveries to score my characters (italics, bold, capital letters, SmallCaps, Underline...). To do this, I created a table, try to store my findTextPreferences and its use in a loop "for".

    I try different writing, but nothing does.

    Store like this:

    caraFindPrefs [0] [0] = "app.findGrepPreferences.fontStyle ="Italic"

    Use like this in the loop 'for ':

    eval (caraFindPrefs [i] [0]);

    Store like this:

    caraFindPrefs [0] [0] = "fontStyle".

    caraFindPrefs [0] [1] = 'bold ';

    Use like this in the loop 'for ':

    app.findGrepPreferences.eval (caraFindPrefs [i] [0]) = caraFindPrefs [0] [1];

    Or like this

    app.findGrepPreferences.caraFindPrefs [i] [0] = caraFindPrefs [0] [1];

    ...

    Do you have advice to do this?

    SEB

    SmallCaps?

    Is not possible.

    It is not a property of the findTextPreferences or findGrepPreferences.

    The omission of the team who wrote the feature for InDesign ExtendScript.

    For other property/value pairs, you could build an array of objects:

    var myArray =
        [
            {fontStyle : "Italic"},
            {fontStyle : "Bold"},
            {underline : true }
    
        ];
    
    var myResultArray = [];
    
    var myScope = app.activeDocument;
    
    for(var n=0; n
    

    Uwe

  • nested styles xml

    Me again, but as everyone seems to be motivated, will try my supplementary question

    You have any advice or managed resources nested Styles to Xml?

    For example:

    italic/bold text italic text bold text

    If I am first marking italic tag just "BOLD", the result will be:

    < i > italic text < /i > < b > text in italic/bold text in "BOLD" < /b > (and it is of course not what I need!)

    So, you are looking for ideas for:

    1. Find a style (it's ok with findText)
    2. test if an xml tag is already applicable on all or part of the findText result
    3. Otherwise, apply the xml tag
    4. If so, find where the 2 styles are both present and apply to all the two and where only the new is apply and him only to find
    5. start over from 1 to all the additional styles
    6. not with 2000 lines of code

    The goal is to get:

    < i > text in italics/i <>< i > < b > bold/italic text < /b > < / i > < b > bold < /b >

    I know I will get crazy, but it's for a good cause

    Crazy life

    By combining and adapting the different ideas of Uwe (. + grep search) and Ariel (function backToNoStyle), I found a pretty easy fix. Need to test more but first try to make sure that it is stable work.

    Here is the code for those who are interested. I just give the "Italic" part but copy/paste (or better put in a loop) the lines in bold to manage other properties (smallcaps, exhibitor...).

    The basic idea is to remove the formatting all the markers of tags you add. In doing so, the findGrep results are cut into large pieces that cannot have multiple nested styles.

    function caraToXml() {
        app.findTextPreferences = app.changeTextPreferences = NothingEnum.nothing;
        app.findChangeTextOptions.caseSensitive = false;
        app.findChangeTextOptions.includeFootnotes = app.findChangeGrepOptions.includeFootnotes = false;
        app.findChangeTextOptions.includeHiddenLayers = false;
        app.findChangeTextOptions.includeLockedLayersForFind = false;
        app.findChangeTextOptions.includeLockedStoriesForFind = false;
        app.findChangeTextOptions.includeMasterPages = false;
        app.findChangeTextOptions.wholeWord = false;
        // italic conversion
        // need to be developed for other styles
        // pay attention to nested xml tags problems
        app.findGrepPreferences = app.changeGrepPreferences = NothingEnum.nothing;
        app.findGrepPreferences.findWhat = ".+";
        app.findGrepPreferences.fontStyle = "Italic";
        var myFindTexts = myDoc.findGrep();
        var myShift = 0;
        if (myFindTexts.length > 0) {
            for (var j = 0; j < myFindTexts.length; j++) {
                var myText = myFindTexts[j];
                var myStartIndex = myText.characters[0].index;
                var myEndIndex = myText.characters[-1].index;
                myXmlElement = myXmlElement.xmlElements.add({markupTag:"i", xmlContent:myText});
                myXmlElement = myXmlElement.parent;
                backToNoStyle(myText.parent.characters[myStartIndex]);
                backToNoStyle(myText.parent.characters[myEndIndex+ 2 + myShift]);
                myShift+=2;
            }
        }
    }

    //
    function backToNoStyle(xmlMarker) {
        xmlMarker.fontStyle = "Regular";
        xmlMarker.capitalization = Capitalization.NORMAL;
        xmlMarker.position = Position.NORMAL;
        xmlMarker.underline = false;
        xmlMarker.strikeThru = false;
    }

  • Beginner GREP style: matches a sentence

    Hello

    I am learning all the wonderful types of styles available in InDesign for a project I'm working on that. I use InDesign CS5. I have a fundamentally just character style characters become smallcaps. I want to use this character as a GREP style style in a paragraph style.

    In the paragraph, if there are strings that match "mm" or "ct" or "ct tw", then use this style of character smallcaps.

    I had the 'Text' field to say: (mm | TB | tw).

    The problem is that I have words like "twin" in the paragraph that I don't want small caps have an impact, so I want to say something like (mm | TB | ct tw), but it does not work.

    I know I can just do a second GREP style for 'ct tw', but I hope there's a way to do it in a single statement. I'm sure that it is a very simple syntax, but I'm completely new to GREP, so pointers will be greatly appreciated!

    Thank you!

    In the biz of jewelry, are we?  I think that this expression should work: \b(tw|mm|ct)\b (feel free to change the order in parentheses). the \b is a word boundary, so it will match only if there is no other character on each side.

  • Create a GREP Style with script? [AS] [CS4]

    Hello

    I am trying to ad a grep for a paragraph style style.

    It is easy to read/write properties that already exist, but how do I create a new?

    It is in applescript, CS4

    Rgds /Mattias

    In JavaScript, it looks like this:

    g = app.documents [0].paragraphStyles.item ("par"). nestedGrepStyles.add ();
    g.appliedCharacterStyle = app.documents [0].characterStyles.item ("smallcaps");
    g.grepExpression = "\\u\\u+";

    If you can find the equivalent of the AppleScript you're home and dry.

    Peter

  • Fonts CS4 &amp; Windows 7

    We got new PCs with Windows 7 and installed CS4.  InDesign is the product of this package, we use most often, but we have the same problem with other programs in CS4.

    We have a ton of fonts that lost us our old PC and we discovered that pieces of some fonts do not work.  What is strange, is that this seems to be true with the Open Type fonts and True Type, those who seem to be OK.  I swear this is the case with all fonts, but this seems to be true for fonts, I explored until now.

    For example, in the Adobe Garamond Pro package, Roman, "BOLD" and were working on the italics, but none of the semibolds & smallcaps were.

    I tried to install the semibolds & smallcaps in the Windows\Fonts folder.  Not recognize them.  I tried to uninstall the entire package Adobe Garamond Pro and put it back.  I have re-installed in two ways, the old drag & drop method and the new way to right click and select Install.  Now the only bit of Adobe Garamond Pro who works is semibold italic.  Roman, bold, italic smallcaps and all the rest are disabled.

    I checked Adobe online documentation, which says:

    The Creative Suite 4 Installer installs fonts in a default system fonts directory. Many of these fonts are updated versions of fonts installed by Creative Suite 3. If the installation program detects that older versions of these fonts in the default system fonts directory, it will be uninstall old versions, then save them to a new directory. The default system fonts directory is:


    Apple Macintosh: < system drive >/Library/Fonts
    Windows: < system drive >: \Windows\Fonts

    The old fonts will be saved in the new directory:
    Apple Macintosh: < system drive > / Library/Application Support/Adobe/SavedFonts/current
    Windows: < system drive >: \Program Files\Adobe\SavedFonts\current

    I have this directory < system drive >: \Program Files\Adobe\ but I do not have a folder SavedFonts.  I tried to create an and put the files of fonts in it, but it does not recognize the file.  After the system restarts, the folder that I created has disappeared.

    Where should I put my font files so that they work?  Is the folder Windows\Fonts in the right place for them?  If so, why are only certain parts of work and others are not?

    Thanks for your help!

    Create a new ID file on the old machine. Use all of the weight Adobe Garamond Pro.

    Save and package the file. You should get the fonts.

    Bob

  • This script is read too quickly?

    Hello, I am currently working on a script that will allow me to take a document, make several global changes, and then save this document under 6 different files in order to make the necessary changes on these particular versions.

    Now the code I use works perfectly fine, except for the fact that it perhaps applies no formatting or the bad formatting specific to the particular versions.  However when we apply specific formatting script individually one at a time, it works very well.

    I could not understand the object class to find a document name and do that in a document object (I'm just getting started, so my names are probably incorrect.)

    So I thought that the question was indesign trhat was still open the file, while the script was still running and so at the time wherever it opens D she asked the formatting of X.  It is a real problem, so is there any kind of function onLoad in indesign scripting format, or maybe a condition in the logon method that requires to wait for the opening at the end?

    Thank you!

    as a forwarning, here in the post, I changed some names of what they just either A, S, D, Z, X or (C) also in the second part of the script A and S are missing. these things are not in the final, I just changed the for here reading.

    Here's the script:

    var myFileName = app.activeDocument.name;

    myDoc var = app.activeDocument;

    var strPrefix;

    var strSuffix;

    strPrefix = myFileName.substr (0, myFileName.lastIndexOf("."));

    strSuffix = myFileName.substr (myFileName.lastIndexOf("."));

    var InFolder = Folder.selectDialog ("If you please choose the destination of the files X 6.");

    function saveDocuments (doc, fullPath) {}

    myDoc.save (new File (decodeURI (inFolder) + ' / ' + (strPrefix + "Has" + strSuffix)));

    myDoc.save (new File (decodeURI (inFolder) + ' / ' + (strPrefix + "S" + strSuffix)));

    myDoc.save (new File (decodeURI (inFolder) + ' / ' + (strPrefix + "D" + strSuffix)));

    myDoc.save (new File (decodeURI (inFolder) + ' / ' + (strPrefix + 'Z' + strSuffix)));

    myDoc.save (new File (decodeURI (inFolder) + ' / ' + (strPrefix + "X" + strSuffix)));

    myDoc.save (new File (decodeURI (inFolder) + ' / ' + (strPrefix + "C" + strSuffix)));

    }

    function save() {}

    myDoc.viewPreferences.horizontalMeasurementUnits = MeasurementUnits.picas;

    myDoc.viewPreferences.verticalMeasurementUnits = MeasurementUnits.picas;

    myDoc.textPreferences.smallCap = 75

    myDoc.textPreferences.superscriptPosition = 33.2

    myDoc.textPreferences.superscriptSize = 60

    myDoc.textPreferences.subscriptPosition = 33.2

    myDoc.textPreferences.subscriptSize = 60

    saveDocuments (myDoc, inFolder.fullName + "/" + myFileName);

    }

    Save();

    for (myCounter = app.documents.length; myCounter > 0; myCounter-)

                {

    app.documents.item(myCounter-1).close (SaveOptions.no);

              }

    "" var = InFolder sFolder + ' ";

    function {D()

    app.open (file (sFolder + "/" + (strPrefix + "D" + strSuffix)));

    var myStyles = app.activeDocument.paragraphStyles;

    var myChStyles = app.activeDocument.characterStyles;

    to (oneStyle = 1; oneStyle < myStyles.count (); ++ oneStyle)

                                        {

    .appliedLanguage myStyles [oneStyle] = "D";

                                        }

    for (unStyle = 1; unStyle < myChStyles.count (); ++ unStyle)

                                        {

    myChStyles [unStyle] .appliedLanguage = "D";

                                        }

    app.activeDocument.save (lead (), true);

    app.activeDocument.close (SaveOptions.no);

                }

    D() ;

    /*

    function Z() {

    app.open (file (sFolder + "/" + (strPrefix + 'Z' + strSuffix)));

    var myStyles = app.activeDocument.paragraphStyles;

    var myChStyles = app.activeDocument.characterStyles;

    to (oneStyle = 1; oneStyle < myStyles.count (); ++ oneStyle)

                                        {

    .appliedLanguage myStyles [oneStyle] = "Z";

                                        }

    for (unStyle = 1; unStyle < myChStyles.length; ++ unStyle)

                                        {

    myChStyles [unStyle] .appliedLanguage = "Z";

                                        }

    app.activeDocument.save (leader (myFileName), true);

    app.activeDocument.close (SaveOptions.no);

                }

    Z() ;

    function X() {}

    app.open (file (sFolder + "/" + (strPrefix + "C" + strSuffix)));

    var myStyles = app.activeDocument.paragraphStyles;

    var myChStyles = app.activeDocument.characterStyles; ;

    to (oneStyle = 1; oneStyle < myStyles.count (); ++ oneStyle)

                                        {

    .appliedLanguage myStyles [oneStyle] = 'X '.

                                        }

    for (unStyle = 1; unStyle < myChStyles.length; ++ unStyle)

                                        {

    myChStyles [unStyle] .appliedLanguage = 'X '.

                                        }

    app.activeDocument.save (leader (myFileName), true);

    app.activeDocument.close (SaveOptions.no);

                }

    X() ;

    function C() {}

    app.open (file (sFolder + "/" + (strPrefix + "C" + strSuffix)));

    var myStyles = app.activeDocument.paragraphStyles;

    var myChStyles = app.activeDocument.characterStyles;

                             

    to (oneStyle = 1; oneStyle < myStyles.count (); ++ oneStyle)

                                        {

    .appliedLanguage myStyles [oneStyle] = 'C ';

                                        }

    for (unStyle = 1; unStyle < myChStyles.length; ++ unStyle)

                                        {

    myChStyles [unStyle] .appliedLanguage = 'C ';

                                        }

    app.activeDocument.save (leader (myFileName), true);

    app.activeDocument.close (SaveOptions.no);

                }

    C() ;

    App.Open (file (sFolder + "/" + (strPrefix + "D" + strSuffix)));

    chughes133 wrote:

    But first of all, I would like to ask why it does not work: * note this is from my memory and so informally written.  If there are spelling mistakes or errors of course, please do not hold account.

    var gPstyles = app.activeDocument.paragraphStyleGroups

    for (i = 0; i<>

    for (p = 0; p<>

    app.activeDocument.paragraphStyleGroup [i] .paragraphStyle [f] .appliedLanguages = "Spanish";

    }

    }

    gPstyles is a collection of paragraphStylesGroups

    gPstyles [i] is a paragraphStylesGroup

    Then you wanted to loop in the paragraphStyles belonging to this group, so the sous-boucle should be:

    for (p = 0; p

    gPstyles [i] .paragraphStyles [f] .appliedLanguages = "Spanish";

    }

    chughes133 wrote:

    (...) This was ultimately the solution I arrived and it worked much simpler than the code above:

    app.activeDocument.allParagraphStyles.appliedLanguage = "Spanish";

    the allParagraphStyles object would allow me to access all styles regardless of grouping.

    You are right! allParagraphStyles quite will simplify the code.

    chughes133 wrote:

    Now my question is that if I make this small change to your code will work as is? OR I have to define other elements.  I think mainly about your language keys. If my code is this:

    LG var = [ENGLISH: ' English: UK ", FRENCH:"French", in SPANISH:"Spanish"]

    for {}

    ??????

    }

    I wouldn't be sure how to identify the key against the name.  Second, you set the name part of the file after the name of the language.  However, in the case of English: UK, I guessed that colon would be in contradiction with the code.

    Thanks for your time again. I'll deepen this link as soon as I can.

    Attention! languages (not the lg) is now an "associative" which is actually an object (not a real table). In this regard the statement needs braces {} (no brackets):

    var languages = {ENGLISH: "English: UK", FRENCH: "French", in SPANISH: "Spanish"};

    Of course, the code must be changed accordingly.

    Try this:

    var languages = {
         // CODE: ""
         ENGLISH: "English: UK",
         FRENCH: "French",
         SPANISH: "Spanish"
         };
    
    (function()
    {
    // check if there's something to do
    // -----------------
    if (app.documents.length == 0) return;
    
    // get the dest folder (cancelable)
    // -----------------
    var inFolder = Folder.selectDialog("Please choose the destination of the 6 X files.");
    if (!inFolder) return;
    
    // now let's go
    // -----------------
    var doc = app.activeDocument;
    
    // preset picas units
    // -----------------
    (function()
         { //: viewPreference
         this.horizontalMeasurementUnits =
         this.verticalMeasurementUnits =
         MeasurementUnits.picas;
         }).call(doc.viewPreferences);
    
    // preset textPreferences
    // -----------------
    (function()
         { // : textPreference
         this.smallCap = 75;
         this.superscriptPosition = 33.2;
          this.superscriptSize = 60;
         this.subscriptPosition = 33.2;
         this.subscriptSize = 60;
         }).call(doc.textPreferences);
    
    // build (once) the helper path fct
    // -----------------
    var getLangFilePath = (function()
         { // : string (doc name)
         var splitName = this.split('.');
         var sfx = '.' + splitName.pop();
         var pfx = decodeURI(inFolder) + "/" + splitName.join('.');
         return function(lg){return pfx+lg+sfx;};
         }).call(doc.name);
    
    // build the 're-style' fct
    // -----------------
    var restyleDocLang = function(doc,lgName)
         {
         var restyle = function()
              { // : array of styles
              var s;
              while(s=this.pop())
                   {
                   try{s.appliedLanguage = lgName;}
                   catch(e){}
                   }
              };
         restyle.call(doc.allParagraphStyles);
         restyle.call(doc.allCharacterStyles);
         };
    
    // then, loop in the associative array
    // -----------------
    for(var lg in languages)
         {
         // languages[lg] is the language name
         restyleDocLang(doc,languages[lg]);
    
         // lg is the language code
         doc.save( new File(getLangFilePath(lg)) );
         doc = app.activeDocument;
         }
    
    doc.close(SaveOptions.no);
    })();
    

    @+

    Marc

  • Creating a style in ID CS4

    It is a question of style of journalism.  I want to create a style in ID CS4 such as:

    1. the first letter is a drop cap, AND

    2. the first line is "BOLD", small caps, AND

    3 the rest of the story is a certain body type.

    Is that possible to have a style that will apply all of this at a time, or do I have to deal with each of these three elements, such as different styles?

    Thank you

    CS4 has 'line Styles. You can select a style of smallcaps for the first

    line.

    Substances

    http://www.in-tools.com

Maybe you are looking for