[JS] [CS3] How do you find an insertion point's paragraph index #?

This is probably a very simple thing to do, but I haven't been able to find a way to reference this. Thanks in advance for any help provided.
Len Swierski

The unexpected higher number is exactly the problem. The paragraph index property has nothing to with the paragraph array position; it's the index of the first character of that paragraph. (Sorry -- you'll have to re-read that post ...)
Fortunately you can still use the returned number. Using the handy function everyItem() on the text frame's Paragraphs collection, you can gather all "first character" indexes into an array. Then it's only a case of testing your InsertionPoint index against the values.
Suppose you copy this post into InDesign and inspect each of the paragraph's indexes. You would get an array like this:
[0, 237, 238, 508, 509 ]
The first value points to the start of the first paragraph in "character count mode". The second value points to the empty line below the first paragraph (I suspect it points to the Return character in InDesign). Since there is nothing else on that line, the next paragraph starts exactly one character after that.
I think the following script does what you need -- but beware! It works, just as you asked, on individual text frames. It even works correctly if the text frame starts in the middle of a paragraph in the previous linked textframe, and this paragraph will correctly be reported to be "#0" of the current frame.
ip = app.selection[0].insertionPoints[0];
parIndex = getParIndex(ip);
alert (parIndex);
function getParIndex (someIp)
     var allPars = someIp.parentTextFrames[0].paragraphs.everyItem().index;
     var loopy;
     for (loopy=allPars.length-1; loopy > 0; loopy--)
          if (someIp.index >= allPars[loopy])
               return loopy;
     return 0;

Similar Messages

  • Premiere CS3: How can you encode xml cue point data in the chapter section of a marker for FlashVid?

    Hi there,
    I'm a total newb to this forum, so hello adobe premiere community! I'm perplexed by Adobes documentation on Premiere (and I'm sure I'm not the first ) anyway on the live documents page below:
    http://livedocs.adobe.com/en_US/PremierePro/3.0/help.html?content=WS9390BED7-9466-46ea-A0E A-3240F1AFC36C.html
    it states that:
    “The cue point data in the Chapter field of a sequence marker in Adobe Premiere Pro will be encoded as Flash XML. For the XML protocol required, see Flash Help.”
    Which is great…except this information doesn’t exist seemingly in either the Premiere documentation or Flash either for that matter, but as I’m interested in working with the chapter/marker area in Premiere – should I really be told to go off and search the documentation for another application, probably not!  What would have been useful would have been a code snippet saying you do it like this, but of course, that would make things too easy!
    Basically, I understand that in After FX you can add Flash marker information specifically for interpretation when exporting to Flash Video (i.e. name, type and parameters etc) and it suggests that you can do the same above in Premiere CS3 using some kind of concatenated string in the chapter area…it just doesn’t tell you how anywhere seemingly – WHY ADOBE!
    Currently when I export markers as cue points based on the advice in the page above, anything I put in the chapter section to force Premiere to create a cue point is converted to a string, which becomes the cue point ‘name’.
    This cue point name is then automatically appended to the ‘time’ the marker was inserted at and is always encoded as type ‘navigation’, with no obvious means of adding ‘parameters’ into the equation.
    So (finally) does anyone know if you can insert this information into the chapter area for correct interpretation by flash (i.e. thus allowing you to choose between either 'navigation' or 'event' types, and pass as many 'parameters' as you wish etc) or are you just limited to supplying a name, and it being automatically set to the navigation type with no parameters?
    I’m sorry for this long essay but at least the issue is well defined for you to answer, honestly any help you can provide what so ever would really be most appreciated!
    Best regards,
    Kat
    PS – I have utterly no knowledge of XML either just in case you were wondering – and my only interest in XML is getting this basic information encoded into the FLV file from Premiere Pro CS3! Please help, pretty please with daisy’s!!!

    Hi dradeke,
    Thanks for your reply, which is indeed useful as clearly Adobe have made this task easier and less obscure in CS4 by adding simple interface functionality, however I'm stuck with using CS3 for the moment.  Its not majorly a problem as the video material in question can be exported uncompressed then setup with cue points using the Flash encoder as an alternative (i.e. or even After FX CS3 also) which both provide the same features as Premiere CS4 seemingly. It is just that it would be much easier to be able to drop in simple markers whilst working with Premiere CS3, as this is what we are going to be using primarily, I just wondered if anyone knew how to invoke this in CS3 - its possible you can't, the documentation is vague at best!
    However I really appreciate your response and help, thanks 

  • How would you find the pitch period of a sound signal?

    Hi
    I have a few questions and i would like if somebody could help me even with the smallest comment on this.
    How would someone be successfully estimate the pitch period (fundamental frequency) of a 5 second sound file?How would you successfully distinguish the voiced from the unvoiced parts and how would you make sure you dont mix voiced/unvoiced sections? Finally how can you find the exact points where the pitch is at its peak throughout the signal?
    Any help/comment/suggesion would be much appreciated

    Hello Madgreek,
    After some thought I think I may have come up with an algorithm for what we have discussed. Basically, you are interested in knowing the time intervals over which you can observe any given frequency in your signal. As you had suggested, you can examine small windows of your signal and perform FFTs on each of the small windows to determine what frequency content is contained in that window. By examining all of the windows, you will see when particular frequencies are prevalent in the original signal. You'd want to use the smallest allowable window to give you the most resolution, but one that is large enough to cover an entire period of the lowest frequency (so that you don't miss this frequency).
    I have attached an example program that performs this operation. The example performs this analysis on an array that represents audio data. I am basically performing multiple FFTs (for each window) and stacking these FFTs in time to form a 3D plot. By examining the 3D plot, I can then see when in time my frequencies of interest are at their peaks. Rather than graphing these plots, you may work out a different algorithm for programmatically determining and logging these peaks and times. I hope this is what you were looking for!
    Attachments:
    Time Variable FFT.vi ‏250 KB

  • How do you find out who did not contribute to a particular fund raiser that we all just did?

    Using MYsql How do you find out who did not contribute to a particular fund raiser that we all just did. There are many titles to the different charities that is under the othpaytitle of the Otherpay table,  I however just want to extract the non-contributors for a particular charity title. Is there anyway to do this? When I do the the syntax below it comes up as an "empty set". The search is done by way of the table Id matching and left joins. Please see below.
    SELECT  moiid, trim(concat(name.fname,' ' ,name.mname,' ',name.lname)) as Brother, name.moiid as Members_ID, sum(otherpay.othpayamt) as NO_Contribution, quadlt.ltfname as quad 
    FROM name 
    LEFT JOIN OTHERPAY  ON name.moiid = otherpay.othpaymoiid
    LEFT JOIN quadlt  ON name.quadlt = quadlt.ltid
    WHERE  Otherpay.othpaytitle like '%food drive%'
    AND otherpay.othpaymoiid IS NULL
    AND name.type = 'BOI'
    AND name.type <> 'jrboi'
    AND name.city = 'SUFFOLK'
    GROUP BY brother
    ORDER BY name.quadlt, brother

    Just guessing based on your query,  and assuming the above query works, just insert a "where" condition. I also removed the SUM function. Also, "AND otherpay.othpaymoiid IS NULL"  may not be needed.
    SELECT  moiid, trim(concat(name.fname,' ' ,name.mname,' ',name.lname)) as Brother, name.moiid as Members_ID, otherpay.othpayamt, quadlt.ltfname as quad
    FROM name 
    LEFT JOIN OTHERPAY  ON name.moiid = otherpay.othpaymoiid
    LEFT JOIN quadlt  ON name.quadlt = quadlt.ltid
    WHERE  Otherpay.othpaytitle like '%food drive%'
    AND otherpay.othpaymoiid IS NULL
    AND name.type = 'BOI'
    AND name.type <> 'jrboi'
    AND name.city = 'SUFFOLK'
    AND othpayamt=0
    ORDER BY name.quadlt, brother

  • HT1848 I rented a movie on my ipod touch and want to watch it on my computer because my ipod is having trouble downloading over wifi. How do you find your rental purchases to download on a computer?

    I rented a movie on my ipod touch and want to watch it on my computer because my ipod is having trouble downloading over wifi. How do you find your rental purchases to download on a computer?

    You cannot.
    iTunes Store: Movie rental frequently asked questions (FAQ)
    If you download a rented movie on your iPhone 4 or later, iPad, iPod touch (4th generation or later), or Apple TV: It is not transferable to any other device or computer."

  • How do you find a table that doesn't have a specific word in it.

    I have two questions.
    questions 1
    How do you find a table that doesn't have a specific word in it by using a query on the whole database?
    questions 2
    How would i list all of my cars names in my database not showing duplicates?
    I have tried, tried and tried some more to get both of these, but I guess i don't know how to query a specific word.
    I also don't know how to query everything in just 1 column name.
    If anyone could help with these that would be great I have been trying queries for over an hour now and no luck.
    Thanks

    798837 wrote:
    I tried the all_tab_columns, just like you did it, however that just gives me the column name I am looking for what is not in a column.
    For example I need to find all the tables where mustang is not = 'red' but using a single query i need to find all of the tables.
    As for number 2
    I am looking for something like this
    select distinct column_name
    from all_tab_columns
    where column_name ='AcertainColumn';Now I'm even more confused. In your example, is MUSTANG a column name? Or is it the value of a MODEL column in the CARS table? And how could that possibly relate to something that exists in multiple tables?
    If your data model is at all reasonable, I would expect that you would just want
    SELECT *
      FROM cars
    WHERE model = 'Mustang'
       AND color != 'Red'but I can't see how this would relate to data stored in multiple tables.
    Justin

  • How do you find your blocked numbers in Contacts or on your iphone?

    How do you find your blocked numbers in Contacts or on your iphone?
    Is there a way to get a list of the blocked numbers?

    Hey jeff work,
    Thanks for using Apple Support Communities.
    This article should be exactly what you are looking for.
    iOS 7: Understanding call and message blocking
    http://support.apple.com/kb/ht5845
    You can review your blocked list through one of the following locations:
    Settings > Phone > Blocked
    Have a nice day,
    Mario

  • How do you find your account history for what you have purchased through iTunes?

    How do you find your account history for what you have purchased through Itunes.  I have purchased apps for my Iphone and music and want to see a listing of where my money went.  I use an itunes card so I can keep an idea on how much I have spent.
    Thanks.

    iTunes Store & Mac App Store: Seeing your purchase history and ...

  • How do you find a notification for Ask to Buy for Family Sharing once it is off your screen and not in drop down Notification Center?

    How do you find a notification for Ask to Buy for Family Sharing once it is off your screen and not in drop down Notification Center?

    Welcome to the Apple Community.
    I don't believe you can.

  • How do you find out if the transmitter and/or receiver leaves the session ?

    So , how do you find out if the transmitter and/or a receiver leaves the session , is there an event when this happens ?

    1. There is no list available from your end.
    2. You can't actually check. If you suspect a device has been, deauthorize it twice and then authorize it.
    (89509)

  • How do you find out what your Apple ID password is?

    A friend of mine forgot their Apple ID password and can't log in. They also don't have access to their email, but that's not the issue. He wants to know how you find out what your current Apple ID password is. He awnsered his security questions but all it would let him do is reset his password, without finding out what his current one is. How do you find out your Apple ID password?

    You can't recover a password, only change it. The reason for this is that Apple has changed their conditions for passwords. They now need to have one upper case letter, 1 number, and be at least 8 characters. Also you cannot use any password you have previously used in the last year.

  • How do you find out what information is in the 'other' section of itunes when iphone is connected

    How do you find out what information is in the 'other' section on the bottom of itunes

    You don't
    If it is much more than a gb or so, then it indicates corrupt files.  A restore should resolve.

  • 1.) How do you find the dictionary in Apple Mail Program?  2.) How do you add another dictionary?

    1.) How do you find the dictionary in Apple Mail Program?  2.) How do you add another dictionary?

    Hello James!
    I do not have any ABAP Instance, only the JAVA one.
    Therefore the ABAP transactions are quite useless.
    The problem tables are created by people working on the CAF layer.
    They have developed and deployed some homemade applications and this is leftovers from their development in some kind of way.
    Anyone with any ideas?
    Could it be that (yet) some special Portal Dictionary Role needs to be asigned to the Administrator?
    /Lasse

  • How can you find out if your mac is infected with the flash back virus

    how can you find out if your mac is infected with the flash back virus?

    F-Secure's Flashback removal tool - http://www.f-secure.com/v-descs/trojan-downloader_osx_flashback_k.shtml - supposedly also works on OSX 10.5 and earlier.
    05 Apr 2012 How to Detect and Protect Against Updated Flashback Malware - http://tidbits.com/article/12918 - detection methods for multiple browsers and general information
    Leopard and earlier users see recommendations at: https://discussions.apple.com/thread/3872491

  • How can you find out what generation your iPod touch is?

    How can you find out what generation your iPod touch is?

    Hi,
    Here is help for the operating system:
    If you are locked to iOS 3 then you have an iPod Touch 1st Gen.
    If you are locked to iOS 4 then you have an iPod Touch 2nd Gen.
    If you are locked to iOS 5 then you have an iPod Touch 3rd Gen.
    If you are locked to iOS 6 then you have an iPod Touch 4th Gen.
    If you can get iOS 7 and have an iPhone 5 sized screen [bigger] you have the current iPod Touch 5th Gen.
    I assume since it says you have iOS 5.1.1 you have an iPod Touch 3rd Gen.
    Also, you may want to sync it so iTunes can tell you or you can look at the model number on the back.
    Hope this helped.

Maybe you are looking for

  • Can I restore my iphone back to itunes

    I lost everything...even my back ups. I would like to copy everything from my phone..everything...  apps, pics, audio books etc. I know there is a ton of software out there, but I don't really trust the claims.  Can anyone suggest software that will

  • Delete message queues

    I had iconnection problems between one of the POA and MTA and I restored this connection after a couple days. now I can see the poa open on the MTA bus the message between the post-offices are not working. I thinking the delete the message queue beca

  • VBIOS request for R9 280 Gaming OC edition.

    Hi I would like a BIOS request as I am experiencing a weird issue; the screen would occasionally flicker for around half a second. I am on the WHQL Catalyst 14.4 drivers on Windows 7 x64 S/N:602-V277-46SB1403000637 my current BIOS can be found here:

  • Why my calendar display different there is one day difference from different  when I see main screen and open the calendar

    See my Why my calendar display different there is one day difference from different  when I see main screen and open the calendar

  • Remove master password

    Desperately trying to remove Master Password. Does not allow me to remove in the Firefox>Preferences>Security space. Am I in the wrong spot. Was also unsuccessful in the Systems Preferences Security area