Column number

Hi!
I´m trying automate my Indesign CS5 without create paragraphs, caracter and object styles.
I need a script increase/decrease a number columns.
Somthings like..
One text frame selected by Selection Tool (NOT type tool) with 1 column and so I apply a script and result a frame with 2 column, apply the script again and 3 column on and on. Other script to decrease column till this frame comes 1 column.
Is it possible? (Sorry for my english)
Thanks!!!

app.selection[0].textFramePreferences.textColumnCount++;
As per your previous question, you ask for "One text frame selected by Selection Tool (NOT type tool)". You cannot select a text frame with the text tool -- or (an alternative interpretation) the text frame is selected automatically when you click a text cursor in it. But it's easy to have this script, and the other one Tomaxxi wrote for you, react on the type of user selection.
You can always check the type of selection immediately for any of ID's objects using "instanceof":
if (app.selection[0] instanceof TextFrame)
  app.selection[0].textFramePreferences.textColumnCount++;
else
  alert ("Please select a text frame first!");
You can also have the script select the "smart" option: if your cursor is in a text and you run the script anyway, chances are you intended to increase the column count. Since the cursor is inside text, you can do something like this:
if (app.selection[0] instanceof InsertionPoint)
app.selection[0].parentTextFrames[0].textFramePreferences.textColumnCount++;
else
alert ("Please select a text frame first");
.. but it has some drawbacks. The "app.selection[0]" will adjust its type to what is actually selected -- if the cursor is idly blinking between two characters it is an InsertionPoint; you can have one or more characters selected, then it's Character. If you happen to have one entire word selected, it's Word. If you have one entire line selected, it's Line; and if you selected an entire paragraph, well, it's Paragraph. (I didn't test but it's probably Story if you selected everything.)
Fortunately, you don't have to check each and every possibility. All of these text objects have something in common: they all have a parentTextFrame. You can check if something "has" a certain property with the command "hasOwnProperty". So, a good way to test if you can change the column count of a frame (regardless what the cursor is pointing to) is
if (app.selection[0] instanceof TextFrame)
  app.selection[0].textFramePreferences.textColumnCount++;
else
  if (app.selection[0].hasOwnProperty("parentTextFrames"))
    app.selection[0].parentTextFrames[0].textFramePreferences.textColumnCount++;
  else
    alert ("Please select a text frame first");

Similar Messages

  • Displaying the Row and Column number in the report

    I am trying to show row and column number in the report (not just web preview). I am using Hyperion Reports Version 7.2.5.168

    use a formula column/row. use RANK function in that. (e.g. Rank([A], asc) will sort the rows based on column A values in ascending order)
    you can use this rank in your heading.
    But frankly this is not so easy. You have to do it in a very intelligent way, so that rank gives you column number/row number any how.
    Have a try and let see if you find a appropriate solution.
    Regards,
    Rahul

  • Column number in JTextArea?

    Hi
    How do I get column number of current cursor
    in JTextArea? I need to display this info
    in my editor.
    This is complicated by the fact that tab size
    is not fixed, typing a combination of space
    and tabs randomly can result in tabs
    having tab size of 1 amid normal tabs.
    Hence counting the number of chars in the
    current line up to cursor position, call it C,
    then C minus number of tabs, T and plus
    T * tabSize won't work because tabSize is
    sometimes 1.
    Thanks
    miawomi

    Hello
    Just figure out how to do this. In case anyone
    get stuck with the same problem, here is my
    soln:
    JTextArea textArea = ...
    int caretPos = textArea.getCaretPosition();
    int lineCount = textArea.getLineCount();
    int tabSize = textArea.getTabSize();
    int currentLine = 1;
    String str = "";
    int c = 0;
    try {
    currentLine = textArea.getLineOfOffset( caretPos );
    int startOffset =
    textArea.getLineStartOffset (currentLine );
    str = textArea.getText( startOffset,
    caretPos-startOffset );
    FontMetrics fm = textArea.getFontMetrics( textArea.getFont() );
                        StringBuffer buffer = new StringBuffer();
    for ( int i = 0; i < tabSize; i++ )
    buffer.append(" ");
    int tabWidth = fm.stringWidth( buffer.toString() );
    for ( int i = 0; i < str.length(); i++ ) {          char C = str.charAt( i );
                             if ( fm.charWidth( C ) == tabWidth )
                                  c = c + tabSize;
                             else
                                  c++;
                   } catch ( BadLocationException ex ) {
                        ex.printStackTrace();
    If anyone has a much less cpu intensive solution,
    please let me know.
    Thanks in advance
    miaw

  • Getting the row and column number from the caretposition

    Howdy peeps
    Does anyone know how to find out the Line number and column in a JTextPane by using the caret position
    (you know like in text editors where it says 100:4 [line number:character position on row])
    is there a simple way of doing this in a JTextPane?

    im getting a bit confuzzled with this :(
    can someone help me out with a bit more code orientated help? :$
    i have a jTextArea and a JTextField, when i change the caret in the text area i want the JTextField to show the line number and charater position on the row (e.g. 100:4)
    so i assume i need to methods
    e.g.
    getPaneRow
    myint=myPane.getCaretPosition()
    do some wonderful magic code to get the line number
    return line number
    getPaneColumn
    myint=myPane.getCaretPosition()
    do some wonderful magic code to get the column number
    return column number
    is there a magician out there that can give me the magic powder? :)

  • Summary Links web part not showing correct column number

    Here is my scenario. I have a simple two server dev farm that is using a snapshot of production data. I have migrated the 2010 content db over and everything is running fine. One quirk I have noticed is with the summary links web part. If I add the webpart
    to a page, in the configuration settings for the webpart you can create named groups and the next setting is how many columns you want the links to appear in. When I select lets say "4" columns, and I create four groups. When I save and check in
    the web part only shows "3" columns instead of 4. 
    For Example. 
    I create groups: Group 1
                              Group 2
                              Group3 
                              Group 4
    In the webpart configuration I select "display number of columns" = 4
    When I save that setting and look at the web part the groups will appear as:
     Group 1             Group 2                    Group 3
    Group 4
    when in reality if the column setting is = 4, I would expect: 
    Group 1      Group 2      Group 3      Group 4
    So it appears it is behaving as if whatever column number you select, what is displayed is N-1. 
    Has anyone else had this happen in SharePoint 2013? The same webpart doesn't behave this way in the 2010 production environment where dev gets its content. Any help would be great. 
    Thanks,

    Hi againeyuga,
    Yes, I have tested in my SharePoint Server 2013 with December 2013 CU  and it  works fine. For your environment, I recommend  you install the SP1 update.
    Best Regards,
    Eric
    Eric Tao
    TechNet Community Support

  • Why order by clause maintains column number values instead of column names

    why order by clause maintains column number values instead of column names ?

    we can use oder by 1,2 as column number
    UGNo one said that it can't be used. What's your point?
    To OP: It can be written with the column's 'select list positional number' just because for the support of laziness. :)
    There's no difference between 'ORDER BY name, address' and 'ORDER BY 1,2'.

  • Get the raw/column number of a left-mouse clicked table cell

    is this possible to get the row/column number of
    a cell where a mouse is clicked? Accutally, i want to implement a
    dynamic one column list which the user can "Add" or "Delete" some entries. The
    "Add" function is all right. The "Delete" function
    makes me upset because I cannot catch the cell's location where the
    mouse is choosing. I tries to use "Active Cell", it seems does not
    work. Do you have any clue? is this possible to implement the dynamic list using the "listbox"? thanks

    I would use the EditPos property value.  In my testing, it always returned the row and column of the cell I had left-clicked on.

  • Purchase order row basecard column number

    hi
    any one help me what is purchase order row basecard column number.
    Thanks & Best Regards
    B.Lakshmi narayanan

    Hi,
    Could you clarify your reguest?
    Thanks,
    J.

  • (wls61sp4)java.sql.SQLException: Invalid column number [jDriver for MSSQL]

    Hi,
    Could any one help me?
    We use weblogic 6.1 SP4 and SQL2000 SP3, and we weblogic's JDBC driver(mssqlserver4v65).
    It seems the JDBC connections is not stable and sometimes throw the exceptions:
    ==========================================
    java.sql.SQLException: Invalid column number (2). This table has 1 columns (a valid index is 1 trough 1).
    java.sql.SQLException: Invalid column number (2). This table has 1 columns (a valid index is 1 trough 1).
         at weblogic.jdbc.mssqlserver4.TdsResultSet.getEntry(TdsResultSet.java:193)
    ===========================
    Thank you.
    --Ted

    Ted wrote:
    Hi,
    Could any one help me?
    We use weblogic 6.1 SP4 and SQL2000 SP3, and we weblogic's JDBC driver(mssqlserver4v65).
    It seems the JDBC connections is not stable and sometimes throw the exceptions:
    ==========================================
    java.sql.SQLException: Invalid column number (2). This table has 1 columns (a valid index is 1 trough 1).
    java.sql.SQLException: Invalid column number (2). This table has 1 columns (a valid index is 1 trough 1).
    at weblogic.jdbc.mssqlserver4.TdsResultSet.getEntry(TdsResultSet.java:193)
    ===========================
    Thank you.
    --TedCan you reliably reproduce this? Are you sure the query being sent returns
    more than one column? You should be using the mssqlserver4v70, not v65, for
    sqlserver2000.
    Joe

  • Is there any option in JTable to add the column number

    Hi,
    I am using JTable to show some data read from database.
    I want to add the column number autometically.(Without by talking a variable and incrementing that by 1.After that add that to the first column.)
    I want just like a auto increment row number.
    Is there any option in JTable?
    Thanks

                        for(int i = 0; i < table.getRowCount(); i++){
                            table.setValueAt(i, i, 0);
                        }

  • A row delimiter should be seen after column number

    A column delimiter was seen after column number <70> for row number <533394> in file
    The total number of columns defined is <70>, so
                                                          a row delimiter should be seen after column number <70>. Please check the file for bad data, or redefine the input schema for
                                                          the file by editing the file format in the UI.
    So i checked the flat file i was trying to retrieve the data for the row number and checked the last column and did not find anything unsual in that row that could have caused this error.
    There are 70 columns and it proposes there is a problem in the last column. I checked but there were no carriage return
    Please help me on this.

    It appears to me the problem with the particular row(s).
    I suggest open the file in notepad if not very big and look at the record number 533394.
    you can also use u2018Overflow fileu2019 option in the error handling section on the target table under the option tab to find out the bad record(s).
    Regards,
    Vibhor

  • The phone column number is unknown

    Why I iPhone mobile phone set inside the phone column number is unknown?My number is telecommunications, also restore settings, for other telecom card, but no effect。Why?

    I have the same problem too with my iPhone 5. I tried putting my sim card in another iPhone 4 to change the number, but that didnt work either. My iMessage and Facetime can only be seen with my email and not my number.

  • How do I keep account of line and column number within JTextArea?

    How do I keep account of line and column number within JTextArea?
    Thanks.

    hi kamlesh,
    to get the number of columns in a JTextArea u have the function
    getColumns() which gives u the number of columns in the text area.
    To get the number of rows present u have the function
    getRowCount() which returns an int that specifies the number of rows in the text area.
    Hope this helps
    Cheers :)
    Nagaraj

  • Column number of caret position

    How can I get column number of caret position. Of course I can use
      int dot = editorPane.getCaret().getDot();
      Element root = editorPane.getDefaultRootElement
      int lineIndex = root.getElementIndex(dot);
      Element lineElement = root.getElement(lineIndex);
      int lineStartOffset = lineElement.getStartOffset();
      int column = dot - lineStartOffset + 1;
    to find the column in a unidirectional text! But what I should do for bidirectional text that has Hebrew, Arabic, or another RTL language? Also with a monospaced font the code
      int dot = editorPane.getCaret().getDot();
      double x = editorPane.modelToView(dot).getX();
      int column = (int) x / someFontMetrics.stringWidth("0") + 1; This won't help anymore. What should I do? The code
      editorPane.getUI().modelToView(editorPane, dot, dotBias) won't work too. First because the dotBias cann't be accessed in DefaultCaret. Second in some cases it probably won't solve the problem.

    Thanks Stats! It won't work!
    Hmmm.... Actually many unicode characters have no width, such as \u064E (Arabic Fatha). Some of them are only for visual ordering purpose, such as \u202A (Left to Right Embedding).
    Paying more attention to English letters, we'll notice ligatures used in some fonts. For instance occurrence of the letters fi (f and i) will produce the one letter &#64257; (\uFB01).
    We saw the algorithm you suggest won't work even for English text! Two ways we have. (In fact these are two mthods I can suggest!)
    1. Using the final output after affecting ligatures and bidirectional algorithm, finding the position of the desired character!
    2. Using xy position of the caret and derive the column number for a fixed font.
    Actually I want to use the second way though the first one is easier and more efficient. That's it! All I want is just the xy position of the caret!
    But ANY IDEA?!

  • XML column letter as opposed to column number

    Hi,
    I upload an XML file to and xstring and used a series of IF_IXML* interfaces to capture it's contents.  Thru these, I'm able to get the column count.  But, I can't seem to find a way to get the corresponding letter of the columns, i.e., A B C, etc. Not the cell name as in A1, but just the column letter.
    Is there a way to get the column letter?  This way, the user may enter the letter in an input box on the screen. Using that letter, I'll know which column to get the data from instead of  having the user count the column number and enter it in the input box.
    Thanks,
    Huntr

    Any takers ?

  • What is excel file's maximum column number limit?

    Hello all,
    I am writing a long csv string within one line to an excel file. When I open the generated excel file, it reports "File not loaded completely". And it only generated patial file.
    I am thinking maybe excel has maximum column number limit, and my excel file required more than 312 columns, that's why it caused this problem.
    Does any one know the answer?
    Thanks in advance !
    Rachel

    Ok, I already solved this problem, excel has a 256 column limit.
    Thanks,
    Rachel

Maybe you are looking for

  • New iMac Wifi Problem!

    Sometime the wi-fi connection freezes and internet doesn't work in the new iMac 21". How do I fix this? Thank you!

  • How to share my ical to my ipod

    I don't know how to share my iCal from my MacBook Air with my iPod (sincronize), please help

  • Spool not generated in RSNAST00 program

    Hi, My requirement is I have certain RMA numbers in internal table and I have to submit RSNAST00 program in background to process all these numbers. I have done that but I am not able to see the generated spool in sp01 transaction. I can see the fini

  • CIM Providers for C210 and ESXi

    Hi, are CIM Providers for ESXi for the C210 Series availible? Michael    

  • AE CC 2014 crashed while rendering scatter fx

    The program keeps crashing and after rebooting and trying to render it crashed trying to render Scatter. What going on? These simple files and all I get is crash. The program also failed while reading some Quicklime files. This is very unstable and I