Select by StoryID textFrame

Hello.

I know that the textFrame has a unique ID.

And I can implement using the SDK.

But I want to select a block of text using JavaScript by StoryID.

Any ideas?

Thank you.

Hello

As I wrote above - it of which one of the containers story will you choose?

A first?

This line selects textFrame 1st overall of containers of history ==> what ID == StoryID:

app.activeDocument.stories.itemByID(StoryID).textContainers[0].select();


Jarek

Tags: InDesign

Similar Questions

  • How to set the font on the text selected in textframe?

    Hello

    I want to change the font (let's say Times New Roman) of the selected text in textframe when I click on the menu of my plug-ins item.

    I have gone through the documentation of the Adobe text engine and tried a code for setting fonts but failed. I do not see a member function in class IFont to set the desired font, so impossible to move forward.

    Please see the code. I would like to know something more that how can we define a specific font for a textframe?

    TextRangesRef rangesRef = NULL;

    result = sAIDocument-> GetTextSelection (& rangesRef);

    aisdk::check_ai_error (result);

    ITextRanges ranges (rangesRef);

    If (mountain ranges. GetSize() > 0)

    {

    Range ITextRange = ranges. Item (0);

    ICharFeatures = range characteristics. GetUniqueLocalCharFeatures();

    IFont fonts;                     I don't see any method to make the desired font.

    features. SetFont();

    Thank you.

    D.A.

    First, download the policy:

    --------------------------------------

    AIFontKey fontKey = 0;

    Error AIErr = sAIFont-> FindFont ("Times New Roman regular", kAIAnyFontTechnology, kNativeAIScript, 0, & fontKey);

    do something with the error

    ATE::FontRef fontRef = 0;

    error = sAIFont-> FontFromFontKey (fontKey & fontRef);

    do something with the error

    ATE::IFont do (fontRef);

    --------------------------------------

    Then, apply like this:

    --------------------------------------

    ATE::TextRangeRef textRangeRef = 0;

    Error AIErr is sAITextFrame-> GetATETextRange (handle_to_artwork & textRangeRef);.

    check error

    ATE::ITextRange textRange (textRangeRef);

    ATE::ICharFeatures charFeatures = textRange.GetUniqueLocalCharFeatures ();

    charFeatures.SetFont (do);

    textRange.ReplaceOrAddLocalCharFeatures (charFeatures);

    --------------------------------------

    There are several other ways to set the text, but you must understand how the paragraph & character styles interact with each other to understand the differneces. It is the simplest way to do it well.

  • Get the position and width of each textFrame line

    Hello!

    I have a file of a designer with a layout of text that has a block of copy centered with lots of kerning adjustments and line breaks. I want to loop through the lines and find the position of Center, left and top (in pixels) of each line of the textFrame. Is there a way to do this in JS?

    Thank you!

    -kc

    Hmm, try this script and see if it works.

    #target illustrator
    
    function test(){
      function newCMYKColor(arr){
          var c = new CMYKColor();
          c.cyan = arr[0];
          c.magenta = arr[1];
          c.yellow = arr[2];
          c.black = arr[3];
          return c;
      }
      function marker(xy, clr){
          var doc = app.activeDocument;
          var p = doc.pathItems.ellipse(xy[1] + 2, xy[0] - 2, 4, 4);
          p.stroked = false;
          p.filled = true;
          p.fillColor = clr || newCMYKColor([0,100,100,0]);
          return p;
      }
      function gridize(pageItems, buffer){
          var tempArr;
          tempArr = pageItems.slice(0).sort(function(a,b){return b.top - a.top;});
          var buffer = buffer || 10;
          /* buffer is the max variance expected between separate rows */
          var vBnds = [];
          for(var i=0; i-1; j--){
                  if(temp[j][1] + buffer >= currentRowYMarker[1] && temp[j][1] - buffer <= currentRowYMarker[1]){
                      currentRowY.push(temp[j]);
                      temp.splice(j,1);
                  }
              }
              if(currentRowY.length > 0){
                  sortedVBnds.push(currentRowY.sort(function(a,b){return a[0] - b[0];}));
              }
          }
          sortedVBnds.sort(function(a,b){return b[0][1] - a[0][1];});
          return sortedVBnds;
      }
      function getRowTop(row){
          var num = 0;
          for (var i = 0; i < row.length; i++) {
              var vb = row[i];
              var top = vb[1];
              if(top > num){
                  num = top;
              }
          };
          return num;
      }
      function getRowBottom(row){
          var num = row[0][3];
          for (var i = 0; i < row.length; i++) {
              var vb = row[i];
              var btm = vb[3];
              if(btm < num){
                  num = btm;
              }
          };
          return num;
      }
      function getRowRight(row){
          var num = row[0][2];
          for (var i = 0; i < row.length; i++) {
              var vb = row[i];
              var right = vb[2];
              if(right > num){
                  num = right;
              }
          };
          return num;
      }
      function getRowBounds(row){
          var arr = [];
          var left = row[0][0];
          var right = getRowRight(row);
          var top = getRowTop(row);
          var bottom = getRowBottom(row);
    
          return [left, top, right, bottom];
      }
      function getRowCenter(rowBounds){
      var r = rowBounds;
      return [r[0] + ((r[2] - r[0]) / 2) , r[3] - ((r[3] - r[1]) / 2)];
      }
    
    //================================================== MAIN =================================================//
      if(app.documents.length > 0){
      var doc = app.activeDocument;
      doc.rulerOrigin = [0,0];
      if(doc.selection.length > 0 && doc.selection[0].typename == "TextFrame"){
      var s = doc.selection[0];
      var dupeText = s.duplicate(s, ElementPlacement.PLACEAFTER);
      var dupeTextOutlines = dupeText.createOutline();
      dupeText = null;
      var myArray = [];
      for (var i = 0; i < dupeTextOutlines.compoundPathItems.length; i++) {
      var thisComp = dupeTextOutlines.compoundPathItems[i];
      myArray.push(thisComp);
      };
      var allLines = gridize(myArray);
      for(var i=0; i		   
  • Browse the selected characters

    Hi guys and girls!

    Everyone has a code snippet to show me how to navigate through the selected text (not the framework!, not the words, only the selected characters) and make changes on the characterAttributes (size, color, etc.)?

    More deeply into it:

    In the 'app.activeDocument.selection' property generally selected objects are stored in table form. Now when I select the characters textframe (or TextPath), there is a [Textrange] in it.

    I've tried a few combinations like this extract sub, but I still get an error, that [i] selectedChars is not defined.

    FYI: I'm on Mac OS X, Illustrator CS4, Javascript

    
    var selectedChars = app.activeDocument.selection.characters;
                            
    for (i = 0; i < selectedChars.length; i++ ){                            
         selectedChars[i].characterAttributes.fillColor = myNewCMYKColor;
    }
    
    

    I hope that I gathered all the relevant information. If not, please do not kill me and just ask for return

    If someone has a smart Board for me?

    Thank you very much in advance!

    OK, you can safely forget all that I said earlier

    Larry my previous script worked only because I started randomly my selection at the level of the second character, just a coincidence here. I was really the textFrame set iteration, so finished rewriting the thing... and in the end, it was like Marc...? It's weird, how do brands did not work?

    Mark, I revisited your script and it doesn't work cos you have a typo in, newSIze, instead of newSize, that has changed and it works great... so you, you still need to understand textRanges and textSelection

    Here is the new version, there is still work to make a real ransom Note generator

    var myNewCMYKColor = new CMYKColor;
    myNewCMYKColor.magenta = 100;
    
    var sel = app.activeDocument.selection;
    
    var fontsize = sel.characterAttributes.size;
    
    for (i=0; i 
               
  • Connect the words specified in textframe with lines

    Hi all

    I want to use the script below, and replace it with a script that connects the words specified with lines. Now, it connects all words with lines. I don't know what to do, so I hope someone can help me.

    Thanks in advance

    #include./lib/bene.jsx
    InDesign CS2 JavaScript
    The value 4.0 script object model
    app.scriptPreferences.version = 4.0;

    ////////////////////////////////////////////////////////////////////////////////////////// ///
    var NomMonScript = app.activeScript.name;

    var myObjectList = new Array;
    If (app.documents.length! = 0) {}
    If (app.selection.length! = 0) {}
    for (var myCounter = 0; myCounter < app.selection.length; myCounter ++) {}
    switch (app.selection [myCounter].constructor.name) {}
    allow only managers of related texts
    case "TextFrame:
    myObjectList.push (app.selection [myCounter]);
    break;
    }
    }
    If (myObjectList.length! = 0) {}
    run the thing! call a function
    myConnectWords (myObjectList);
    }
    else {}
    Alert ("Please select TextFrame and try again.');
    }
    }
    else {}
    Alert ("Please select an object and try again.');
    }
    }
    else {}
    Alert ("Please open a document, select an object and try again.');
    }

    ////////////////////////////////////////////////////////////////////////////////////////// ///
    functions
    ///////////////////////////////////////////////////////////////////////////////////////// ////
    function myConnectWords (myObjectList) {}
    myDocument var = app.activeDocument;
    var myLayer, myCounter, myColor;

    Measure
    var myOldRulerOrigin = myDocument.viewPreferences.rulerOrigin;
    myDocument.viewPreferences.rulerOrigin = RulerOrigin.spreadOrigin;
    Save the units of measure.
    var myOldXUnits = myDocument.viewPreferences.horizontalMeasurementUnits;
    var myOldYUnits = myDocument.viewPreferences.verticalMeasurementUnits;
    Create the units of measurement to points.
    myDocument.viewPreferences.horizontalMeasurementUnits = MeasurementUnits.points;
    myDocument.viewPreferences.verticalMeasurementUnits = MeasurementUnits.points;

    Get references no nuance.
    var myNoneSwatch = myDocument.swatches.item ("None");

    Create a color (if it does not already exist).
    myColor = myDocument.colors.item (myScriptName);
    try {}
    myColorName = myColor.name;
    }
    {} catch (MonErreur)
    var myColorArray = new Array (100, 0, 0, 0);
    myColor = myDocument.colors.add ({model: ColorModel.process, space: ColorSpace.CMYK, colorValue:myColorArray, name: NomMonScript});
    }

    Create a layer for the generated lines (if it does not already exist).
    myLayer = myDocument.layers.item (myScriptName);
    try {}
    myLayerName = myLayer.name;
    }
    {} catch (MonErreur)
    myLayer = myDocument.layers.add({name:myScriptName});)
    }

    Process objects (here the text blocks) in the selection.
    for (myCounter = 0; myCounter < myObjectList.length; myCounter ++) {}
    Download textframe
    var myNewFrame = myObjectList [myCounter];

    get all the lines in the frame
    var myLines = myNewFrame.lines;
    linking every word with all of the words in the following line
    for (myLineCounter = 0; myLineCounter < myLines.length - 1; myLineCounter ++) {}
    get all the words in the line + next line
    var myLine = myLines [myLineCounter] mentioning;
    var myNextLine = myLines [myLineCounter + 1] mentioning;
    myPathPoints.push([myLine.insertionPoints[-2].horizontalOffset,myTmpY]);

    Combine this + line then the words
    for (i = 0; i < myLine.length; i ++) {}
    Get the word
    var myWord_i = myLine [i];
    Table for the points
    var myPathPoints = new Array;
    Add fist point X/Y
    myPathPoints [0] = [myWord_i.horizontalOffset, myWord_i.baseline];

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

    Get the word

    var myWord_j = myNextLine [j];

    If (myWord_j.baseline! = myWord_i.baseline & & myWord_j.horizontalOffset! = myWord_i.horizontalOffset) {}

    Add the second point X/Y

    myPathPoints [1] = [myWord_j.horizontalOffset, myWord_j.baseline];

    draw the line

    myDrawPolygon (myPathPoints, 1, 100, myColor, myNoneSwatch, myLayer);

    }

    }

    }

    }

    }

    myDocument.viewPreferences.rulerOrigin = myOldRulerOrigin;

    Set the units of measure to their State of origin.

    myDocument.viewPreferences.horizontalMeasurementUnits = myOldXUnits;

    myDocument.viewPreferences.verticalMeasurementUnits = myOldYUnits;

    }

    Well Yes - Fun little exercise, it was.

    Select an entire text block, or text directly, and this script logs all the words with the character style "label". The lines are at the centre of reference of each word.

    if (app.documents.length == 0 || app.selection.length != 1 ||
     !(app.selection[0] instanceof TextFrame || app.selection[0].hasOwnProperty("baseline")))
    {
     alert ("Please select a single text frame or some text first");
    } else
    {
     charStyleName = "label";
     app.findTextPreferences = null;
     app.findTextPreferences.appliedCharacterStyle = app.activeDocument.characterStyles.item(charStyleName);
     list = app.selection[0].findText();
     if (list.length == 0)
      alert ('No text found with char style "'+charStyleName+'"');
     else if (list.length == 1)
      alert ('Only one text found with char style "'+charStyleName+'", no use in going on');
     else
     {
      lpath = [];
      while (list.length)
       lpath.push ( centerOfWord (list.shift()) );
      if (app.selection[0] instanceof TextFrame)
       pg = app.selection[0].parent;
      else
       pg = app.selection[0].parentTextFrames[0];
      while (!(pg instanceof Spread || pg instanceof MasterSpread || pg instanceof Page))
      {
       if (pg instanceof Document || pg instanceof Application)
        break;
       pg = pg.parent;
      }
      l = pg.graphicLines.add({strokeWeight:0.5, strokeColor:app.activeDocument.swatches.item("Black")});
      l.paths[0].entirePath = lpath;
     }
    }
    function centerOfWord (word)
    {
     var l = word.insertionPoints[0].horizontalOffset;
     var r = word.insertionPoints[-1].horizontalOffset;
     return [ (l+r)/2, word.baseline ];
    }
    
  • [JS] How to change the type of stroke?

    app.selection[0].strokeWeight = 3;     // app.selection[0] = [object TextFrame]
    app.selection[0].strokeCornerAdjustment = StrokeCornerAdjustment.DASHES;
    

    Hello.

    I tried this code, but error.

    error message: property is not applicable to the current state.

    How to change the type of dotted line?

    You must use the strokeType method, try this

    App.Selection [0] .strokeWeight = 3;

    App.Selection [0]. StrokeType = "dashes (3 and 2).

  • [JS] How to get storyUID?

    Hello.

    I can get a graphicFrameUID.   "app.selection [0] user.user.

    But I want to get the storyUID.

    Get a ' [user.user app.activeDocument.stories.item (i)] / / [write mode: app.selection [0].parent.id] "but I want the storyUID of the selected textFrame.

    Is it possible?

    Thank you.

    A TextFrame "owns" not a story, it's more the other way around. You are probably looking for a textframe parentStory: app.selection [0].parentStory.id (when the selection is a textframe).

    This, of course, means that for a story threaded permanently, all management related texts will have the same id in the history. If this is a problem depends on what you need to.

  • Concatenation of the contents of paragraph

    Hello guys,.

    I'm on a script which is concatenation of a string to some elements of paragraph.  In fact, after concatenation, the formatting of the paragraph replaces by the first character in the paragraph (no paragraph style were used).

    myDoc var = app.activeDocument;

    var selection = myDoc.selection;

    var num_blocks = selection.length;

    for (var i = 0; i < num_blocks; i ++) {}

    If (.) Selection TypeName [i] == 'TextFrame') {}

    var selection [i] .paragraphs = paragraphs;

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

    paragraphs [j] .silence += 'xxx ';

    };

    }

    else {}

    do nothing

    }

    };

    Example:

    Capture.PNG

    The text is to have respected the original formatting, while the rear 'xxx' should have been formatted as "today".

    Would be grateful if someone could help.

    change this

    paragraphs [j] .silence += 'xxx ';

    for this

    Paragraphs [j]. Words.Add ('xxx');

  • It is scriptable to unscrew the paragraphs [or lists] to get blocks of text?

    The method I use is to break a story in many pages, split a block of text via the menu "Save options" + ' paragraph 'start' on the next page and then apply a script which unscrew all of the text. " But a lot of time and work involved not to mention that the stories not threads isolated in dozens of pages.


    But my scripts known to wire/unscrew the text might only manage the frames and never paragraphs.


    The idea is to convert this kind of paragraph/lists in four simple stories

    Fig. 180 - risk 2010-2014

    Fig. 181 -number of devaluation 2009-2014

    Fig. 182 - Inflation 2008

    Fig. 183 - average index of prices

    Probably a hiccup of copy/paste of my own:

    var main = function() {
      var ps, n;
      var hu;
      if ( !app.documents.length ||
      app.selection.length!=1 ||
      !(app.selection[0].properties.parentStory) ){
      alert("Please select a text frame");
      return;
      }
    
      hu =  app.activeDocument.viewPreferences.horizontalMeasurementUnits;
      vu =  app.activeDocument.viewPreferences.verticalMeasurementUnits;
    
      app.activeDocument.viewPreferences.horizontalMeasurementUnits =
      app.activeDocument.viewPreferences.verticalMeasurementUnits = MeasurementUnits.POINTS;
    
      ps = app.selection[0].parentStory.paragraphs;
      n = ps.length;
    
      try {
      while ( n-- ) {
      createFrame ( ps[n] );
      }
      }
      catch(err){
      $.writeln ( ">>>"+err );
      }
    
      app.activeDocument.viewPreferences.horizontalMeasurementUnits = hu;
      app.activeDocument.viewPreferences.verticalMeasurementUnits = vu;
      if ( app.selection[0] instanceof TextFrame ) {
      app.selection[0].remove();
      }
      else {
      app.selection[0].parentTextFrames[0].remove()
      }
    }
    
    function createFrame (p) {
      var x1 = p.insertionPoints[0].horizontalOffset,
      x2 = p.insertionPoints[-2].endHorizontalOffset,
      y2 = p.characters[0].baseline,
      y1 = y2-p.characters[0].pointSize+3.35;
      y2+=5;
      var tf = app.activeDocument.layoutWindows[0].activePage.textFrames.add({geometricBounds:[y1,x1,y2,x2]});
      p.duplicate ( LocationOptions.AT_BEGINNING, tf.insertionPoints[0] );
    };
    var u;
    app.doScript ( "main();", u, u, UndoModes.ENTIRE_SCRIPT );
    

    Try again?

  • Need help to modify the findchangebylist.jsx script

    I alternate the same script vbs to meet my needs and I was happy about it (likeChild when you give him his favorite toy) but I run into som problems with when I copy and place the script vbs on another computer I want to using it called CS6 instead of CC... I tried everything I could think of but no luck... same thing happens whenever I try to use CS6 open rather CC in which I run it... on the computer I write the script running like charm (on both computers, I have CS6 and CC)... so I decided to use the same script jsx version...

    then, when I try this script:

    1. the dialog box opens only when my cursor is textframe allowing me to select what I want to change the selected item 2. 1 document. 3 selection

    2. when I select 2 blocks of text and document I have 3 or more, the script does not change in 2 pictures selected instead she does in all settings

    I need to rotate this script

    When I select the text block to open dialogbox allow me to take 2/3 of the options mentioned above, the number 2 and 3

    He doesn't find it and change only in blocks of text I selected (when it is selected with the Selection tool) not in all settings

    I tried to do it my self, but a little short of knowledge im

    I tried to switch the dialog case is open, adding the line case 'TextFrame': in this part of the script

    If (app.documents.length > 0) {}

    If (app.selection.length > 0) {}

    {Switch(App.Selection[0].constructor.) Name)}

    case 'PointInsertion ':

    'character ': case

    case "word":

    case 'TextStyleRange ':

    case "line":

    stops of the "Point":

    case "TextColumn":

    case 'text ':

    case "cell":

    case "column":

    case 'Row ':

    case 'Table ':

    myDisplayDialog();

    and it works to call the dialog box when the text block is selected, but then he didn't make changes textframe don't debut not overall selected...

    So I tried to experiment with this line

    if(myResult == true) {}

    {Switch (myRangeButtons.selectedButton)}

    case 0:

    myObject = app.documents.item (0);

    break;

    case 1:

    MyObject = app.selection [0] .parentStory;

    break;

    case 2:

    myObject = app.selection [0];

    break;

    }

    myDialog.destroy ();

    myFindChangeByList (myObject);

    }

    else {}

    myDialog.destroy ();

    }

    by changing the number 1, 2 or 3, but that only the script says that if I have 2 block of selected text to search in the second block of text (incase of number 1) or if I have selected 3 and if numer 2 only script in text 3

    I need help please

    Hello

    I ment something like this:

    //...
    var myResult = myDialog.show();
      if(myResult == true){
           switch(myRangeButtons.selectedButton){
                case 0:
                     myObject = app.documents.item(0);
                     myFindChangeByList(myObject);
                     break;
                case 1:
                     if (app.selection[0].constructor.name == "TextFrame")
                          for (var b = 0; b < app.selection.length; b++)  {
                               myObject = app.selection[b].parentStory;
                               myFindChangeByList(myObject);
                          }
                     else {
                          myObject = app.selection[0].parentStory;
                          myFindChangeByList(myObject);
                          }
                     break;
                case 2:
                     myObject = app.selection[0];
                     myFindChangeByList(myObject);
                     break;
                }
           myDialog.destroy();
           }
           else {
                myDialog.destroy();
           }
    //...
    

    App.Selection is a table, but its length is always a number.

    If the 1st element of selection is a TextFrame (or more) ==>, we get into a loop

    on the other ==> we call a function that had been initially.

    Jarek

  • script to return the amount of left &amp; right parenthesis &amp; media

    The copy of ingredients below seems correct you?  Try the evidence and feel our frustration.

    Well, I tend to believe there is an extra right parenthesis, and this is a perfect job for a script. Can we make a script to return:

    Left parentheses: XX

    Right parenthesis: XX

    Left parentheses: XX

    Right media: XX

    Left braces: XX

    Right braces: XX

    or propose another method for the County / evidence. I've been the colorization of sections.

    INGREDIENTS: Dulce De Leche Caramel [corn syrup, sweetened condensed milk (pasteurized milk, sugar), water, palm oil, cream, glycerine, pectin, salt, Phosphate disodium, (emulsifier), soy lecithin, natural and artificial flavor, CARRAGEENAN and Sorbate de Potassium (conservative)], the Whip topping [water, corn syrup, palm kernel oil, sugar, contains less than 2% of the following: COPRA oil] (, (derived from A milk) Sodium caseinate, dextrose, gum Arabic, gum of carbohydrates, salt, xanthan gum, natural flavour, extracted, morning of beta carotene to rice), wheat flour, palm oil, sugar, eggs, pecan nuts, milk, butter [cream (milk), water]. Chocolate drizzle [corn syrup, water, cocoa (processed with alkali),-modified maize starch, glycerine, (conservative) potassium sorbate, artificial flavour], cocoa (processed with Alkali), baking soda, Benzoate de Sodium (conservative)

    CONTAINS: Milk, soy, wheat, eggs, Pecans

    Hi Mike,.

    It's been many moons (10 months) that I posted here. Anyway, I have been 'hidden' forums every day since and did some searching for something today and came across this thread so I decided to post. I don't know whether or not you have received one response from others (cough: Carlos ;-), in any case, perhaps this will help your efforts, otherwise, it's a basic example):

    // ---------------------------------------------------
    // Script Purpose: Check And Count All Brackets
    // Script Name: W_J_T_checkBrackets.js
    // Test Environment: Mac - Illustrator CS5
    // Forum Source: https://forums.adobe.com/thread/1564938
    // © W_J_T 2/24/2015
    // ---------------------------------------------------
    
    function checkBrackets() {
        if (app.documents.length == 0) {
            alert("Script Aborted:\nNo Open Document Found");
            return;
        }
        if (app.activeDocument.selection.length != 1 || app.activeDocument.selection[0].typename != 'TextFrame') {
            alert("Script Aborted:\nPlease select a single text frame and try again");
            return;
        }
        if (app.activeDocument.selection[0].typename == 'TextFrame') {
        // This section returns the # count for each type of bracket:
            var txtString = app.activeDocument.selection[0].contents;
            var LP = txtString.split("(").length - 1;
            var RP = txtString.split(")").length - 1;
            var LB = txtString.split("[").length - 1;
            var RB = txtString.split("]").length - 1;
            var LC = txtString.split("{").length - 1;
            var RC = txtString.split("}").length - 1;
            alert("Results:\n" + "Left Parenthesis:  " + LP + "\nRight Parenthesis:  " + RP + "\nLeft Brackets:  " +LB + "\nRight Brackets:  " + RB + "\nLeft Curly Brackets:  " + LC + "\nRight Curly Brackets:  " + RC);
            // This section returns just the brackets as a string to see the visual sequence:
            alert(returnBrackets(txtString).split('').join(' ') + "\n * visual representation of brackets");
            function returnBrackets(txt) {
                var brackets = /[^()\[\]{}]/g;
                return ("" + txt).replace(brackets, "");
            };
            // This section changes the color to RED, size to 20 and font to Verdana of all brackets in the selected text for easier finding and editing:
            // Note: However keep in mind, the execution time will increase for large portions of text when using this portion of the code.
            var redColor = new RGBColor();
            redColor.red = 255;
            redColor.green = 0;
            redColor.blue = 0;
            var txtString = app.activeDocument.selection[0];
            for (var i = 0, l = txtString.characters.length; i < l; i++) {
                var txtChar = txtString.characters[i];
                if (txtChar.contents == "(" || txtChar.contents == ")" || txtChar.contents == "[" || txtChar.contents == "]" || txtChar.contents == "{" || txtChar.contents == "}") {
                    txtChar.characterAttributes.fillColor = redColor;
                    txtChar.size = 20;
                    txtChar.characterAttributes.textFont = app.textFonts.getByName("Verdana");
                }
            }
        }
    }
    checkBrackets();
    

    I suppose it could be expanded further, but it is a starting point and could, however, be useful for your efforts. It will be useful.

    W_J_T

  • Problem of Muse | The menu link stuck in State 'active '.

    I work with a menu and you have a link that is stuck in the "active" State No matter if I manually change to normal, it keeps active default. Why this is happening and how to fix it?

    Ryan

    Hi Ryan,

    Here's what you need to do to fix the link Industries - select the "INDUSTRIES" textframe inside the trigger - make sure that the textframe is selected and is not the trigger - and select the drop-down list of hyperlinks field that has the link to the applied Industries page. Click the X button next to the hyperlink field to remove the link of the textframe.

    After doing the above, as well as other triggers - trigger Industries would have the link but the textframe inside doesn't have the link attached to it. Now preview/publication to check the link of Industries.

    Let me know if you face problems making the fix.

    See you soon,.

    Vikas

  • change the numbers by comma-dot and vice versa

    Hello

    I have this script that changes the format of the European numbers to the United Kingdom / U.S. (for example 1,000 to 1,000) and does not apply to numbers preceded by any letter.

    for now it is partially works very well, changing only those digits preceded by the letters without the space between them. for example: machine type TSK4.500 in TSK4, 500 will not be changed and that the OK.

    I need to recognize and does not also change those prefixed numbers of letters with a space:

    TSK 4,500 must not be activated.

    So I need in a few words, this script to work only with numbers by avoiding those who might be part of a name, etc..

    can someone help me please?

    Thank you very much

    CINZIA

    try {main ()}

    catch (_) {alert ("could not execute.")}

    int main() {}

    Function FindItems () {}

    If (app.selection.length == 0) {return app.activeDocument.findGrep () ;}

    If (app.selection [0] .hasOwnProperty (of"base")) {return app.selection [0] .findGrep () ;}}

    If (app.selection [0] instanceof TextFrame) {return app.selection [0].parentStory.findGrep () ;}}

    exit ();

    } / / FindItems

    BEGIN main

    app.findGrepPreferences = app.changeGrepPreferences = null;

    app.findGrepPreferences.findWhat = "\\d+[,.\\d]+\\d+";

    app.findGrepPreferences.findWhat = "[?]". \\l\\u]+\\d+[,.\\d] » ;

    app.findGrepPreferences.findWhat = "[!]. [ \\l\\u]] +\\d+[,.\\d]";

    app.findGrepPreferences.findWhat = "\\d+[,.\\d"];

    var Found = FindItems ();

    var Temp;

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

    {

    Temp [i] = trouve.contents.replace (/, / g, ' # ');

    Temp = Temp.replace (/ \./g, ",");

    [I] found .silence = Temp.replace (/ #/ g, ".");

    Alert (temp);

    }

    app.findGrepPreferences.findWhat = "[\\l\\u]+\\d+[,.\\d]";

    app.findGrepPreferences.findWhat = "\\d+[,.\\d"];

    var Found = FindItems ();

    var Temp;

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

    {

    Temp [i] = trouve.contents.replace (/, / g, ' # ');

    Temp = Temp.replace (/ \./g, ",");

    [I] found .silence = Temp.replace (/ #/ g, ".");

    Alert (temp);

    }

    Hi Cinzia,

    As I told you privately, I think this grep code is better. Only, this line to change:

    app.findGrepPreferences.findWhat = / ^-* [\d,.] + \d/.source;

  • If typename question

    Sorry if this is a silly question, but can someone let me know why the if/else code below does not work?

    The script is supposed to determine which of the two selected objects is a block of text and give it the variable 'text '.

    var docRef = app.activeDocument;
    if (docRef.selection[0].typename = "TextFrame"){
      var text = docRef.selection[0];
      var other = docRef.selection[1];
    } else {
      var text = docRef.selection[1];
      var other = docRef.selection[0];
    };
    

    unique equal (=) - assignment.

    Double equal (==) - comparison

  • Illustrator text spiral Shrinking/growin', scaling to the bottom/top on the spiral path

    First of all, thanks in advance for anyone who can help, or that it is even possible... (please me touch ADAM razo.ad1985 -> G.mail)

    An urgent need of Assistant skills. Years ago I DLded this script and got this working and older Illustrator. NOW, I have Illustrator CS6. I wanted to love/like to type text on a spiral path, then have the abitly for "user (entering custom values) entry" insofar as

    Start/Pt font size = 80

    End/Pt font size = 12

    Just a concept... (maybe someone can do)

    desired spiral script.jpg

    Then have illustrator (script) perform action and do my big spiral (80pt) the beggning of text and the smaller (12 pt) stop there for research as POLICE/TEXT gradually reduced in size from end of selection up to what (80pt) beginning of do / text (12pt)

    similar to this final result after srcipt ran (and entered values)

    spiralText Concept.jpg

    I know there's a script plus there... but if someone can maybe undate and modernize with prompt commands for interaction with the user entry/customization

    ChangeSizesOfTextSelection.js-> http://forums.Adobe.com/thread/447657

    Hi razo.ad1985,

    Your second photo shows a distortion, right?

    But any. Try this:

    // CharSizeChangeFromFirst2LastInProportion.jsx
    
    // http://forums.adobe.com/thread/1414597?tstart=0
    
    // select a text frame or pathtext before running this script
    // test this script at first with only a few characters!
    // The more letters, the longer it takes
    
    // If the screen seems to be frozen - please wait for a while
    
    // regards pixxxelschubser  25/Febr./2014
    
    var aDoc = app.activeDocument;
    if (aDoc.selection.length > 0) {
        if (aDoc.selection.length < 2 && aDoc.selection[0].typename == "TextFrame") {
            var aTFrame = aDoc.selection[0];
            var theChars = aTFrame.characters;
            var charLength = theChars.length;
            var startSize = prompt("size of first character", 25,"start size");
            var endSize = prompt("size of last character", 5,"end size");
            var step = (startSize-endSize)/(charLength-1);
            for (i = 0; i < charLength; i++) {
                theChars[i].size = (startSize - i*step).toFixed (2);
                redraw();
                }
            } else {alert("Please select only one text frame")}
        } else {alert("No selection")}
    

    Have fun

Maybe you are looking for