How to find the paragraph and line numbers [CS3] [JS]

Hello,
I have a script that finds certain text formatting. Rather than having the script select all the instances of this text I have an alert that lists the page number and the contents for each found instance. The following gets those.
var pageNumber = myFoundSet[n].parentTextFrames[0].parent.name;
var foundContents = myFoundSet[n].contents;
However, I would like to include the number of the paragraph where the found text resides as well as the line number in that paragraph.
I am stumped on how to do this. Would be nice if there were a parentParagraph and a parentLine.
Can someone point me in a direction?
Thanks,
Tom

Tom,
Assuming that you're looking for the number of the paragraph on the page, you'd need to count the number of paragraphs in the text frame that a found item occurs in. Since indexes are always counted from the beginning of the story, you isolate the text between the top of the page and the found item by starting at the index of the first insertion point of the found item's parent text frame and the found item itself. You capture that with this single long line:
// range over ...
paragraph_number = myFoundSet[n].parentStory.characters.itemByRange (
   // ... index of first ins. point of found item's parent text frame ...
   myFoundSet[n].parentTextFrames[0].insertionPoints[0].index,
   // ... and index of found item
   myFoundSet[n].index
   ).paragraphs.length;
This includes any paragraph that started on the previous page. To find the found item's line number within its parent paragraph you do something similar:
line_number = myFoundSet[n].parentStory.characters.itemByRange (
   myFoundSet[n].paragraphs[0].index, //first insertion point of paragraph
   myFoundSet[n].index
   ).lines.length;
There's no need for parentParagraph and parentLine: myFoundSet[n].paragraphs[0] returns an item's parent paragraph, myFoundSet[n].lines[0], the item's parent line.
Peter

Similar Messages

  • How to find a paragraph with restarting numbering [CS3] [Javascript]

    Hi,
    Does any of you know how to solve this one:
    I am making a script which needs to search for numbered paragraphs, and assign it with a specific paragraph style. It should go like this:
    If the paragraph's numbering restarts (meaning it starts with 1) - the style should be "Number1".
    If the paragraph's numbering continues from where it is - the style should be "Number".
    It sounds quite simple in theory, and even doable with the simple "Find/Change" operation in InDesign, but when I went over the object model, I couldn't find a single method for my script to differentiate between the two cases. Does any of you know of a method for this?
    Here is what I've got so far:
    app.findTextPreferences = NothingEnum.nothing;
    app.changeTextPreferences = NothingEnum.nothing;
    app.findTextPreferences.bulletsAndNumberingListType = 1280601709; // Numbers
    app.changeTextPreferences.appliedParagraphStyle = "Number";
    app.changeText ();
    app.findTextPreferences = NothingEnum.nothing;
    app.changeTextPreferences = NothingEnum.nothing;
    Thanks,
    Ola

    numberingRestartPolicies might be the thing you are looking for.

  • How to find the header and item level status of a CRM contract ?

    Hi,
    Few questions
    A. How to find the header and item level status of a CRM contract ? My req is to select all the contract line items which are in CLOSED status.
    B. How to get the BPs associated with a contract ?
    Anyone have the list of CRM tables and the relation amongst them. Please mail me in [email protected]

    CRMD_ORDERADM_H     Contains the Header Information for a Business Transaction.
    Note:
    1.     It doesn’t store the Business Partner
           responsible for the transaction. To 
           get the Partner No, link it with
           CRM_ORDER_INDEX.
    2.     This table can be used for search
           based on the Object Id(Business
           Transaction No). 
    CRMD_CUSTOMER_H     Additional Site Details at the Header Level of a Business Transaction
    CRMD_LINK     Transaction GUID set for all the Business Transactions
    CRMD_ORDER_INDEX     Contains Header as well as Item details for a Business Transaction.
    Note:
    1.     It doesn’t store the Business 
          Transaction No (Object ID).
          To get the Business Transaction No  
          link the table with
          CRMD_ORDERADM_H
    2.   This table can be used for search
          based on the Partner No
    CRMD_ORDERADM_I     Stores the Item information for a Business Transaction. The scenarios where we have a Contract Header and within contract we have Line Items for the contract, this table can be useful.
    E.g. Service Contracts
    CRMD_CUSTOMER_I     Additional Site Details at the Item Level of a Service Contract
    Pl.reward points.......

  • How to find the Date and Time of Modification of Column in aTable?

    Hi all,
    Do  you know how to find the Date and Time of Addition of Column to a Particular Table?.
    I know however, How to find the modification time of the Table. Using the below Query :
    Select Object_Name, to_Char(Last_DDL_TIME, 'DD-Mon-YYYY HH24:MI:SS') Last_DDL from User_Objects where Object_Type = 'TABLE';
    Object_Name
    Last_DDL
    Employee
    20-Aug-2013 09:23:03
    I wanted to know the Creation or Modification Date and Timestamp of all columns of Employee Table?. Is it possible at all. If possible, How to get it?.
    Regards,
    Bhaskar M

    I agree with you on that. Since its a development enviornment I can remove the column but that not my point here.
    My whole purpose it to know whether we get the Column's Creation or Modification DateTime.

  • How to find the job and job status from RSPCM

    hi all,
    suppose we got an error and in rspcm the process was failed.i want to know the status of that particular job.and if any i want to stop that job in SM37.
    plz tell me how to find the job and job ststus from RSPCM...and how to stop that job in SM37
    thanks,
    jack

    Hi Jack,
    RSPCM: T.Code
    This transaction is used to monitor the process chains
    First:
    here you need to add the process chains into the sheet
    Second:
    Then you can monitor the process chains in this transaction code
    Like you can see the :  status ,proces chain ,Last run date ,Last run time ,Log ID
    Status : Green when sucessful,Yellow when running & Red when you get errors
    Now when yoy click on any of the process chain in RSPCM you will go to the LOG VIEW as you see in RSPC transaction
    SM37:T.code
    This transaction is used for Job Overview
    you can see many options in SM37
    like Released,active,cancelled,finished,etc
    Just select the ACTIVE  jobs and also pass STAR in JOB ID & USER ID
    here you can only see the active jobs
    Goto Step in toolbar
    select the program displayed
    then chose option GOTO - Variant in main menu bar
    in the variant you can see the job belong to which Process chain
    if you want to cancel this job come back to SM37 Display screen
    Select the Job and select the JOB DETAILS tab in Tool Bar
    Collect the WIP ( Work Permit ID)
    Go to SM50 T.code and find the WIP
    in Main Menu Bar you find the option Cancel with Core choose this it will cancel the Job
    Regards
    Hari

  • How to find the Project and wbs Element System Status

    Hi all,
      How to find the Project and wbs Element System Status.
      We can find the system status in the CJ20n transaction but I want the table and field name where it is stored.
    Regards
    Raghavendra

    Hi,
    try table <b>jest</b> with key = prps-objnr
    Andreas

  • How to find the font and replace another font using javascript in illustrator?

    Dear All,
    how to find the font and replace another font using javascript [batch process] in illustrator?
    i have 700 image file, it very deficult replace one by one.
    regards,
    .Suresh.S

    Ask the creator of the file for a unprotected version.

  • How to find the columns and tables used in a stored procedure?

    Hi,
    Can someone suggest how to find the columns and tables used within a stored procedure?
    Thanks
    VBK

    For example:
    SQL> create or replace
      2    procedure p1
      3      is
      4          cnt number;
      5      begin
      6          select count(*) into cnt from emp;
      7  end;
      8  /
    Procedure created.
    SQL> select  referenced_owner,
      2          referenced_name
      3    from  dba_dependencies
      4    where owner = 'SCOTT'
      5      and name = 'P1'
      6      and referenced_type = 'TABLE'
      7  /
    REFERENCED_OWNER               REFERENCED_NAME
    SCOTT                          EMP
    SQL> SY.

  • How to find the jre and j2ee version on RAD?

    How to find the jre and j2ee version of RAD 6.0?

    Hi Zhenglin,
    You meen to say we have to create two custom fields, one each for the latitude and longituude. Once created, how do we upload the latitude and longitude based on address could you please expalin by giving some sample code.
    Thanks in advance.
    Thanks and regards,
    Deepika C

  • How to find the source and target systems of an imported Transport Request?

    Hello,
    How to find the source and target systems of an imported Transport Request?
    chinna.

    Hi Chinna,
    In your landscape the TMS must have configured.Let assume that you have four six systems in the land scape.
    DEV->DEV1->QUA->PRD and other two systems (TR1 ,TR2)are at different domain amd both are connected to QUA and the requests are forwarded from there.Here normally the flow willl be from DEV to DEV1, then DEV1 to QUA and QUA to PRD.For other two systems (TR1 ,TR2 )the source system will always be QUA.
    Regards
    Ashok

  • How to Find the highest and lowest cell in a column and figure the difference

    What I am tryng to do is have numbers find the high and low in Cloumn B and and put the difference in B6. So I would need it to Figure out that B3 is the highest and B2 is the lowest and give me the difference of .25 in B6

    Don,
    Begin by making Row 6 a Footer Row. You will find that option in the row tab menu that appears when you hover over the 6 tab and click the triangle.
    Then enter this formula in B6:
    =MAX(B)-MIN(B)
    Regards,
    Jerry

  • What is CPI-C  and how to find the username and password for a 4.7c install

    Dear Friends,
    Please tell me what is a CPI-C username is ??
    When do we use it?
    And how/from where  could  I find the CPI-C user name and password of a particular system(4.7c)?
    Please give me a detail knowledge.
    waiting for replies ....
    thx,
    jeevan

    OS X 10.7 Lion, 10.8 Mountain Lion & 10.9 Mavericks
    Reset Password starting from Recovery HD
    Start the computer,then press and hold down command and R keys to start into recovery partition.
    When you see the Apple logo, release the keys.
    Wait until  OS X Utilities window shows up.
    Move the mouse to the menubar at the top and click "Utilities", then select "Terminal"
    from the drop down.
    Terminal window will appear.
    Type in   resetpassword   and press enter on the keyboard.
    Leave the Terminal window open.
    Reset Password Utility window will open with Macintosh HD selected.
    Select the user account from the popup menu box.
    Enter a new password.
    Reenter the new password for the user.
    Enter a hint.
    Click the "Save" button.
    Click  in the menubar and select Restart.
    Log in.
    If Keychain dialog box appears, select “Create New Keychain”.

  • How to find the open po line item by using EKKO &EKPO tables

    Hi Gurus,
        what i am doing is finding out the OPEN PO line item from EKPO table. I know it has to check the ELIKZ field from the EKPO table.Can you please clarify me on the same in more detail.I has to use the ELIKZ  EREKZ fields from EKPO table.

    Use the field ELIKZ in EKPO. If the field is Blank its an OPEN PO Line Item
    refer this link.
    How to open PO line item

  • How to find the Music and Movies folder in your Finder

    I wish I bought a cheap computer with low GB space because MacBook Pro GB is not enough so you have to buy an external harddrive anyway.
    Anyway I wanted to delete some music files but I couldn't delete it from the Disk Inventory. I remember someone from Apple navigating my files from the Finder Macintosh HD and saw how much GB of movies and music I had and then I could delete it then and there, but I can't find the folder he went to. I found it once after so much hard finding and then I got lost again as I tried to find it again today.
    So how do you find that place?

    Whitecity wrote:
    Out of interest, how much space is on your harddrive? Replacing it with a larger one is easy and cheap.
    It is much easier to purchase an external HD and store the ITunes library on it.

  • How to find the HEAP and CHUNK of memory in Oracle

    hi,
    Intermitently I'm getting some ora-00600 errors that indicate corruption in some heaps and chunks, as follow:
    Repeat 79 times
    Chunk 3e05a198 sz= 0 ERROR, BAD MAGIC NUMBER (0)
    Dump of memory from 0x3E059198 to 0x3E05B198
    3E059190 00000000 00000000 [........]
    3E0591A0 00000000 00000000 00000000 00000000 [................]
    and
    HEAP DUMP heap name="CCursor" desc=367B4F18
    extent sz=0x424 alt=32767 het=16 rec=9 flg=2 opc=0
    parent=03C38510 owner=3E46E22C nex=00000000 xsz=0x424
    EXTENT 0 addr=3E05A190
    ERROR extent at 3E05A190 contains wrong ds 00000000
    How do I find those heaps and chunks corrupted and how to fix it ?
    Any tips will be very usefull
    Regards

    The only way to "fix" the corrupted memory is to login to MetaLink, use the ORA-600 lookup tool to see if there is any info on the particular ORA-600 you encountered. If so, find out if there is a patch or workaround available. If the lookup tool doesn't turn up anything, open an SR and work with Oracle support for resolution.
    As far as the corruption that has already occurred, well, if it's only in memory (which is the most likely case) then there's really nothing you can do to fix it. If it caused on-disk corruption, then you'll need to restore/recover from a recent backup.
    Hope that helps,
    -Mark

Maybe you are looking for

  • Program won't load after moving to new computer

    Hi, So, I was having an incredibly difficult time on my mid 2010 iMac trying to use Premiere Pro CC after I had installed new memory.  The program stopped responding and/or anytime I tried to render or encode, the entire computer would restart.  It h

  • I am unable to activate my copy of Adobe Acrobat 9 Pro

    I need assistance installing/activating the copy of Adobe Acrobat 9 Pro that came with my copy of Creative Suite 5 Web Premium.  I tried to use the key for CS5 and my volume license key for Acrobat 9 Pro to no avail.  I have a couple license keys wri

  • Thunderbolt to Gigabit ethernet does not work anymore.

    I had purchased a Thunderbolt to Gigabit ethernet a few months back and has been working fine. Recently in my Network Preference it is not recognized anymore. I removed it hoping it would pickup and nothing. I switched ports and nothing. I tried my a

  • Lost itunes libary how can i tell my itunes that it´s my iphone?

    Hi, my computer just crashed, now i got a new one, but how can i tell itunes that this is my new computer and that this is my iphone? The phone is available in itunes but i can´t switch anything, (apps, music etc) plz help me

  • Segment/ Business unit in the customer ageing

    hi Friends,        Am using the cube 0FIAR_C03 for getting the customer ageing report, In this report customer is askinig for the Segment(BU), also to be added. But i dont find tat in the query. now wat is the possibilty for the same. Thanks Karthik