Apply the last character of line color

Hi all

I'm newbie in Javascript.

Question: I want to apply the color to the last character in the line. It does not work.

My lines are:

myDocument var = app.activeDocument;

myLine var = myDocument.stories.everyItem ().lines.everyItem () .getElements ();

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

{

myLine [i] .characters. item(-1). fillColor = "SS";

}

I think that the error which was held in the item(-1) only occurance.

Can someone give the solution?

/ * But if I want to apply the color at the beginning of the line, it works.

This is the line i follow:

myDocument var = app.activeDocument;

myLine var = myDocument.stories.everyItem ().lines.everyItem () .getElements ();

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

{

myLine [i].characters.item (0) .fillColor = "SS";

}*/

Hello X,

You must check the end doubled characters is undesirable space, enter brand, shift enter, etc...

Please try the JS code below.

var myDocument = app.activeDocument;
var myLine = myDocument.stories.everyItem().lines.everyItem().getElements();
for(i=0; i

THX

csm_phil

Tags: InDesign

Similar Questions

  • delete the last character of line break

    How can I remove the newline character from the end of a string? (Note: there are several line break characters in the string). Thank you!

    This may or may not work, but it is worth it.

    If (right (Votrechaine, 1) is 10)
    Votrechaine = left (Votrechaine, 1, len (yourstring)-1);

  • Apply the last PSU (Jan2014) on 11.2.0.3 DB

    Hi Experts,

    I recently installed RHEL 5 (64-bit) and Oracle 11 g 2 (11.2.0.3) database on my test for learning em12c machine. After that, I installed OEM12c R2 (12.1.0.2) without any problem.

    Now, I have to apply the latest security patches and fixes for 11.2.0.3 group database. According to the metalink Note 1454618.1, last available power supply is 11.2.0.3.9

    While applying the last PSU, I get the error next and need for assistance by experts in this forum.

    The OPatch out to patch up the 11.2.0.3 with the 11.2.0.3.9 Oracle database power supply

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

    The following warnings occurred during execution of OPatch:

    (1) YES-67215:

    OPatch found the word "warning" in the stderr of command brand.

    Please look at this stderr. You can rerun this command make.

    Stderr output:

    ins_precomp.mk:19: warning: overriding commands for target 'pcscfg.cfg '.

    /U01/app/Oracle/product/11.2.0/Db_1/precomp/lib/env_precomp.mk:2160: warning: ignoring old commands for target 'pcscfg.cfg '.

    /U01/app/Oracle/product/11.2.0/Db_1/precomp/lib/ins_precomp.mk:19: warning: overriding commands for target 'pcscfg.cfg '.

    /U01/app/Oracle/product/11.2.0/Db_1/precomp/lib/env_precomp.mk:2160: warning: ignoring old commands for target 'pcscfg.cfg '.

    (2) YES-67215:

    OPatch found the word "warning" in the stderr of command brand.

    Please look at this stderr. You can rerun this command make.

    Stderr output:

    ins_emagent.mk:113: warning: overriding commands for target 'nmosudo '.

    ins_emagent.mk:52: warning: ignoring old commands for target 'nmosudo '.

    /U01/app/Oracle/product/11.2.0/Db_1/SYSMAN/lib/ins_emagent.mk:113: warning: overriding commands for target 'nmosudo '.

    /U01/app/Oracle/product/11.2.0/Db_1/SYSMAN/lib/ins_emagent.mk:52: warning: ignoring old commands for target 'nmosudo '.

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

    According to the questions of whether in meatlink doc 1593211.1 , below warnings are harmless and can be ignored without risk.

    WARNING: ignoring old commands for target 'pcscfg.cfg '.


    Can someone please confirm if I can ignore the warnings so below... ??

    WARNING: ignoring old commands for target 'pcscfg.cfg '.


    Going further, I would be grateful if anyone can provide me with some useful documents or links to the deployment of officers in EM12c as well. It's the next course of action after you have applied the latest patches of power supply and safety.


    Thank you

    Ankur-

    See MOS Doc 1448337.1

    HTH
    Srini

  • Delete the last character in the input field

    How to remove the last character of an input field?

    It deletes all

    When you click on:

    SYM.$("textfield"). Empty();

    Thank you!

    Try this:

    var inputTxt = sym.$("textfield").text ();

    var truncatedTxt = inputTxt.slice (0, -1);

    SYM.$("textfield"). Text (truncatedTxt);

    HTH,

    Vivekuma

  • Retrieve the Position of the last character of Textlayer

    Dear script Experts!

    I wonder if there is a way to get the properties of the position of the last character in a text layer.
    For example, I used this in ActionScript: txt.getCharBoundaries (txt.length - 1);

    Thanks for any help

    Mike

    Available properties for a text layer are:

    applyFill

    applyStroke

    Dialoguegeneral

    boxTextSize

    fillColor

    Police

    fontSize

    Justification

    pointText

    strokeColor

    strokeOverFill

    strokeWidth

    text

    follow-up

    Last I saw, by the data type character recovery was still not available. Even in AE CC. Any extraction layer text property is based on the first character in the text string. So if each character used a font, point size, kerning, etc. only the values of the first character could be found.

    Re: Is it possible to access the text by character properties via script?

    Some other posts here that speak of the location of the text layer:

    Attribute boxTextSize ADBE Text Document

    Get a text box anchor point after scaling

    You can always ask too.

    Adobe - feature request/Bug Report Form

  • Select the last character of a string

    Hello
    I want to select the last character of a string address. "For example, as a result of select ' 165 John Ave W '-'W '. I tried to use the RIGHT but it does not work. I am using sqlplus.

    SELECT RIGHT(ADDRESS,1) FROM addresses;
    ORA-00904: "RIGHT": invalid identifier

    I can't find that any select statement to get the result I want. Ideas?

    Thank you!

    You want: SUBSTR (, - 1).

  • Select from the table where the last character of the string is numeric

    Hello
    I have a table of STREETS with a field called ADDRESS. I want to select all the records in streets where the last character in the address is a number.
    Select ADDRESS of STREETS where regexp_like (substr (address,?,?,), '[0-9]');
    --? means that I don't know what to put here!

    I don't know if substr is the best approach to do this, because I want only the last character and the records are of different lengths.

    Thank you!

    Hello

    If you want to use regular expressions:

    WHERE     REGEXP_LIKE ( address
                  , '[0-9]$'
                  )
    

    You can get the same results, no doubt more effectively, without regular expressions:

    WHERE     INSTR ( '0123456789'
               , SUBSTR (address, -1)
               )     > 0
    
  • Find the last character in a string aplhanumreic

    Hi guys first time poster long time hiding in the shadows, I hope someone can help me

    I put the stored username and I need to find the last character before the number, for example

    ABC123 that I would like to find c
    AB123 I would find b

    suggestions as to how I could do this?
    Thanks in advance

    Here's one way:












  • CSS to force the last character of a paragraph to align differently?

    I have a CSS problem. Let's say I have a paragraphy of 450 pixels wide, text - align left (default). The last line of the paragraph ends at a place which is about three quarters of the total paragraph width. Now, I want to add a span encompassing a last character that is a different color than the text of the previous paragraph and also positions on the side over to the right of the 450 pixels.

    I tried two things that did not work. One was text-align: right and the other was including a couple of spaces before the final character and using tracking to lie, he. Absolutely no effect during each test.

    Help?

    HealthcareHelper wrote:

    Osgood, I just tried your first suggestion and it works! I might have to play with him, because he did exactly as said: go to the right side complete paragraph width and none of the text is going well. It looks like a little isolated.

    I assumed the description you gave in your original post you wanted that he isolated on the far right of the container?

    HealthcareHelper wrote:

    is there a particular reason that offers on a simple float, or was it based on your experience?

    Floating of the seemed to be the logical way to go (I guess on the basis of experience) BUT if you notice that the character is not on the same line as the last line of the point. If this isn't a problem, then it is a possible soultion to consider using.

    HealthcareHelper wrote:

    In addition, was the possible problem of browsers with the second suggestion because of the limited for inline-block support?

    No, inline-block is supported in all browsers I know. I was just being cautious as I had not tested under IE. However this solution with the character on the same line as the last line of the paragraph, I provided it as an alternative.

  • Extract the first line containing "critical" or "E-Stop" of the last avalanche of line

    Hi all

    I'm watching some test systems by analyzing their audit files.

    In this case, the platform generates several line 100 files in a specific folder. The code below is to find the last file and extract the contents of the last line of the last file.

    Unfortunately, when an error occurs, the main software generates not only one entry, but an avalanche of lines [not a specific quantity of them, depending on how much the alarms are resolved] and I'm now ideas of how I could identify and the contents of the first line containing "Criticism" or "E-Stop" to exit from this avalanche [line avalanche started 22.27].

    As an example, the above program is extract the yellow line, while I need information from the blue line.

    Any idea on how I can do this?

    See you soon,.

    You can add this snippet to the top of your existing code.  I changed the indicator table to a table so I could highlight the line.

  • TextInput is missing the last character

    My code includes a textinput coded in this way:

                   inWeightField.setPosition(650,240);
                   inWeightField.width = 300;
                   inWeightField.height = 30;
                   inWeightField.textField.restrict="0-9."
                   inWeightField.textField.maxChars=7;
                   //
                   var temp:String = inWeightField.text;
    

    The issue I see is that the last charater in temp is chopped, i.e. If 50.23 is entered, the temp = 50.2

    Why the last char is chopped and how this can be fixed?

    Hey Rita,.

    I think that you run in a kind of race condition. what you do in your listener function? If you set the temp string then most likely, you must use the KeyboardEvent.KEY_UP event instead. I think that the TEXT_INPUT event fires BEFORE any character is placed in the TextInput object. the KeyboardEvent.KEY_UP occurs after the character is displayed in the TextInput object. try to change the event and see what happens. Good luck!

  • How can I return my product key for Windows 7, when I lost the last character (letter) of it?

    I got a product key for win7 professional to Network MSDN, but unfortunately I do not have type last character check. Is it possible to get it back?

    Can I use a key of win 7 for win 7 SP1?

    (1) simply log in to your MSDN account and check your keys here.

    (2) Yes - the key is which on any level of SP.

  • Select before the last character.

    I have some URLS in a picture like this

    http://test.com/ABC/ghgh.html

    http://test.com/BCD/

    http://test.com/FFF/default.aspx

    http:// test2.com/a

    I want to select all the items before the last.

    But if the last / is it after the .com can get just how it is.

    so before should translate into

    http://test.com/ABC

    http://test.com/BCD

    http://test.com/FFF

    http:// test2.com/a

    create table soqs2)

    URL varchar2 (50)

    );

    insert into soqs2 values ('http://test.com/abc/ghgh.html');

    insert into soqs2 values ('http://test.com/bcd/');

    insert into soqs2 values ('http://test.com/fff/default.aspx');

    insert into soqs2 values ('http:// test2.com/a "");

    SQL and PL/SQL are the same forum...

    Check my last response to your original thread select prior to last character /

  • Help with a script that detects the content in a cell and apply the cell style to line

    Hello


    I am trying to add an article to my table formatting script that is a cell with the word 'Budget' (but this can be written as ' Budget:' or ' Budget: (E) "- but without the speech marks) and apply the cell Style - SponsorCells - to all the cells of the whole line. I currently have on what it will, but it does not work:


    function checkWhichTable()
    {
    // ensure the user made a selection
    if (app.selection.length != 1)
    return null;
    var currentTable = app.selection[0];
    if (currentTable.hasOwnProperty("baseline"))
    {
    currentTable = app.selection[0].parent;
    }
    while (currentTable instanceof Cell || currentTable instanceof Row || currentTable instanceof Column)
    currentTable = currentTable.parent;
    if (!(currentTable instanceof Table))
    {
    // No table selected
    return null;
    }
    return currentTable;
    }
    app.doScript(checkUserSelection, ScriptLanguage.JAVASCRIPT, undefined, UndoModes.ENTIRE_SCRIPT, "Process Table");
    
    
    function checkUserSelection ()
    {
    var a_table = checkWhichTable();
    if (a_table == null)
    {
    if (confirm("No table selected. Do you want to process *all* tables?") == false)
    return;
    allTables = app.activeDocument.stories.everyItem().tables.everyItem().getElements();
    for (aTable=0; aTable<allTables.length; aTable++)
    {
    processTable (allTables[aTable]);
    }
    } else
    {
    processTable (a_table);
    }
    }
    function processTable(table)
    {
    // do something here!
    
    
    //Set 1st Row Height
    table.rows[0].height = "30mm";
    
    
    //Find Text in Cell and apply Cell Style to Row 
    var  
      myCellText=['Budget', 'Budget:', 'Budget: (E)'];  
     var myRegEx = new RegExp("^("+myCellText.join("|")+")$");
      for (i=0; i<table.cells.length; i++)
      {
        if (table.cells[i].texts[0].contents.match(myRegEx))
          table.cell[i].appliedCellStyle = "SponsorCells";
      }
    
    
    //end - do something here!
    }  
    


    I can get the script to apply the cell style to "SponsorCells" for each cell that contain the word 'Budget' etc, but I need cell ever on this line to have the cell style applied. I tried to re-write line 56 which applies the style to a cell, but I can't seem to make it work. Any help would be great.


    Separate on this issue, I would like to have a line of code similar to the 46 line, which sets the 1st height of lines, but I would like to say "If a cell has 'A cell Style' and then applies the value height 10 mm". If someone could result as a help of bonuses, things would be great double.


    Thanks in advance!

    But that could be painfully slow. To speed things up, follow these steps:

    var cells = table.cells.everyItem().getElements();
    for (var i=0; i
    

    It is faster, because it creates an array of cells with a call to table.cells, which is several times faster than calling table.cells. And before assigning to line 12mm height is useful to check if it is already 12 mm. checking things in InDesign and do things only when it is necessary is much more effective than simply doing things even if they are not necessary.

  • To remove the last "/" character

    I need to remove ' / ' character and string comes after him. I'll give an example.

    CREATE TABLE TAB (COL1 VARCHAR2 (50));

    INSERT INTO VALUES TAB ("IHA/SS/TTTT/FFFF');

    INSERT INTO TAB VALUES (' hDFF/AA/S/AAAAAAAA");

    I would remove the last "/" and chain comes after him then when I ask, I should get the result that

    IHA/SS/TTTT
    hDFF/AA/S

    Please help me
    with testdata as (
      select 'hDFF/AA/S/AAAAAAAA' s from dual union all
      select 'hIA/SS/TTTT/FFFF'     from dual
    )
    
    select
     substr( s
            ,1
            ,instr(s, '/', -1) - 1
     ) r
    from testdata        
    
    R
    hDFF/AA/S
    hIA/SS/TTTT
    

Maybe you are looking for