How can i search and retrieve the first word ...

How can i retrieve the FIRST or the SECOND word in a document stored in a file_datastore ?
Thanks
null

You noticed the first one yourself: the Found item list seems to randomly jump around the document -- I believe you are correct in your observation it may be due to the object construction order. That tells me, by the way, something about your lot numbers that tou didn't mention: your text is not one continuous long threaded story, but it's all or partially in disconnected etxt frames. The Found list does return everything inside a single story in the correct order, but it goes over each separate story in the order they were constructed.
The only solution is to gather all of your lot numbers, *re-sort* them according to the page number they appear on (and some sort of Worst Case Scenario is when you might have more than one lot number frame per page; in that case you also need to sort by textframe, top to bottom -- yet even worse is if you also may have these textframes side by side!).
Only then you have a reliable counting order.
This isn't too bad. We can just extend the method I offered for sorting top-to-bottom/left-to-right in Re: Working around the frame selection order issue in CS 4 and make it also include page numbers:
function byPageYX(a,b) {
    var
        aP = a.parentTextFrames[0].parentPage.index,
        bP = b.parentTextFrames[0].parentPage.index,
        aY = a.baseline[0],
        bY = b.baseline[0],
        aX = a.horizontalOffset[1],
        bX = b.horizontalOffset[1],
        dP = aP-bP,
        dy = aY-bY,
        dx = aX-bX;
    return dP?dP:(dy?dy:dx);
myResults.sort(byPageYX);
Or something like that.
As for actually implementing the above I cannot be of any help with Applescript.
Once we're dealing with sorting I think you're much better off in Javascript anyhow.

Similar Messages

  • How can I search and replace the order items appear in the document?

    Here is my script. I am trying to replace instances of a text pattern (Lot ^9^9^9^9^9) with an auto incremented number Lot 1, Lot 2, Lot 3, etc... I believe this script produces unexpected results becuase the search result is ordered by document construction. The first item in myfounditems is the last item added to the document (which is on the last pages of the document), the second item in myfounditems is the next to last item that was added to the document (which was moved to a middle page in the document). The net result is that instead of having the first item on the first page being Lot 1) and the item directly below it being Lot 2), my document is a hodgepodge of Lot numbers is a seeminlgly random order. Any thoughts on how to fix this?
    tell application "Adobe InDesign CS5.5"
      --Clear the find/change preferences.
              set find text preferences to nothing
              set change text preferences to nothing
      --Search the document for the string "lot".
              set find what of find text preferences to "Lot ^9^9^9^9^9)"
      #set change to of change text preferences to "Lot " & lotnum & ")"
      --Set the find options.
              set case sensitive of find change text options to false
              set include footnotes of find change text options to false
              set include hidden layers of find change text options to false
              set include locked layers for find of find change text options to false
              set include locked stories for find of find change text options to false
              set include master pages of find change text options to false
              set whole word of find change text options to false
              tell active document
                        set lotnum to 1
                        set myFoundItems to find text
                        repeat with foundItem in myFoundItems
                                  set contents of object reference of foundItem to "Lot " & lotnum & ")"
                                  set lotnum to lotnum + 1
                        end repeat
              end tell
    end tell
    display dialog ("Numbered " & (count myFoundItems) & " lots in this document. Next starting lot number is " & lotnum & ".")

    You noticed the first one yourself: the Found item list seems to randomly jump around the document -- I believe you are correct in your observation it may be due to the object construction order. That tells me, by the way, something about your lot numbers that tou didn't mention: your text is not one continuous long threaded story, but it's all or partially in disconnected etxt frames. The Found list does return everything inside a single story in the correct order, but it goes over each separate story in the order they were constructed.
    The only solution is to gather all of your lot numbers, *re-sort* them according to the page number they appear on (and some sort of Worst Case Scenario is when you might have more than one lot number frame per page; in that case you also need to sort by textframe, top to bottom -- yet even worse is if you also may have these textframes side by side!).
    Only then you have a reliable counting order.
    This isn't too bad. We can just extend the method I offered for sorting top-to-bottom/left-to-right in Re: Working around the frame selection order issue in CS 4 and make it also include page numbers:
    function byPageYX(a,b) {
        var
            aP = a.parentTextFrames[0].parentPage.index,
            bP = b.parentTextFrames[0].parentPage.index,
            aY = a.baseline[0],
            bY = b.baseline[0],
            aX = a.horizontalOffset[1],
            bX = b.horizontalOffset[1],
            dP = aP-bP,
            dy = aY-bY,
            dx = aX-bX;
        return dP?dP:(dy?dy:dx);
    myResults.sort(byPageYX);
    Or something like that.
    As for actually implementing the above I cannot be of any help with Applescript.
    Once we're dealing with sorting I think you're much better off in Javascript anyhow.

  • How can we iterate and retrieve the data from the slices ?

    Hello,
    All is said in the question...so..
    Thanks in advance.

    Hi,
    try with the info from the following link I think it'll be helpful:
    <a href="http://help.sap.com/saphelp_nw04/helpdata/en/f6/f856d2469c11d4aa1100a0c9430730/frameset.htm">http://help.sap.com/saphelp_nw04/helpdata/en/f6/f856d2469c11d4aa1100a0c9430730/frameset.htm</a>
    Regards, Violeta

  • How can I login and retrieve my user file from the trash?

    I was trying to find out where all my HD had gone, which a did using ‘What Size’.
    I found what looked like an old backup file so I put the file in the trash.
    It turns out that the file was my user file. So now I can’t login to as the user.
    How can I login and retrieve my user file from the trash?

    The Digital Editions forum is here, in case this is what you are talking about:
    http://forums.adobe.com/community/adobe_digital_editions
    If you are not, I apologize for the misunderstanding.

  • My daughter created a movie using iMovie, which she has worked on for a month, when trying to save it on a jump drive she was asked to "finalize" the movie...now there is no record of it at all. Any ideas how I could try and retrieve the file?

    My daughter created a movie using iMovie 11, which she has worked on for a month. When trying to save it on a jump drive she was asked to "finalize" the movie, and while this was running (quoted 13 hours!) she received an error message. Now there is no record of it at all, I have looked in trash etc. Any ideas how I could try and retrieve the file?

    The file cannot be reloaded in iMovie using File > Open Recent  ??
    There is no trace of the file in a Spotlight search?
    The project files are not under <user>/Movies/iMovie Projects ??
    Finalizing creates small, medium and large version of the finished video. It does take a long time, but it should not destroy your project files.
    Oh, and you really MUST have a backup of your files. You can expect to lose files if you have no other copies of them.

  • What, exactly, are 'encoded assets'? Why does removing them resolve problems? How can they be avoided in the first place?

    What, exactly, are 'encoded assets'? Why does removing them resolve problems? How can they be avoided in the first place?

    As I understand it, encoding fomats your digital video clips and photos (assets) into Standard DVD mp2 format so that it can be burned to a DVD.  If there has been an error in the encoding process, then you remove the old encoded assets and start over.  There are numberous reasons why there can be errors in the encoding process. 

  • How can u insert and retrieve text files in any format using forms6i.

    how can u insert and retrieve text files in any format using forms6i.
    can u give me an example of an insert statement, let's assume the file is located in the a:drive.
    and retrieving the files, i would give the user a list of all the files that are in the database, the user would select one, but what command(or piece of code) would open the file in its apppropriate editor.
    e.g .pdf formatted file would open in acrobat.
    any help would be appreciated.
    Thanks
    Hussein Saiger

    the filereference class is for downloading and uploading files.
    if you want to load xml, use the xml class.
    and, if you want to write to an xml file and don't want to use server-side code, wait.

  • I haven't get any receipt of purchases since mid January 2014. How can I contact and let the itune fix this? (I live in Thailand, not available to call or find local support.)

    I haven't get any receipt of purchases since mid January 2014. How can I contact and let the itune fix this? (I live in Thailand, not available to call or find local support.)

    Has the ISP modems and routers been power cycled then tested again? 
    Possible ISP connection issues or LinksysSmartWiFi.com service outage maybe...
    Are FW versions on all routers up to date? 
    To safely update FW, I recommend doing the following: Download the FW file from the support site first.
    Disable the auto update feature on the router. <If this was on, possible someting was updated recently. I recommend leaving this OFF.
    1. Save router config to file first using IE or FF with all security add-ons disabled.
    2. Factory reset the router with all other devices disconnected or turned OFF accept for 1 wired PC.
    3. Reload or Update the FW using IE or FF. Just download the FW file to your local wired LAN PC.
    4. Factory reset the router and then set up from scratch first and test with out loading the saved config from file. Check to see if any problems are fixed before loading the saved config from file. Sometimes you need to set up from scratch with out loading the saved config file. Just safer that way.

  • I have multiple iPhoto libraries w/ duplicates in several. How can I consolidate and find the dupes? Some photos are versions of the original.

    I have multiple iPhoto libraries w/ duplicates in several. How can I consolidate and find the dupes? Some photos are versions of the original. On my iMac, I also have many folders containing some of the same photos. My computer is used for both personal and business purposes. My libraries should be separated, one for each.

    To merge libraries use iPhoto Library Manager - http://www.fatcatsoftware.com/iplm/ -  or Aperature
    To find duplicates within an iPhoto library use iPhoto Library Manager - http://www.fatcatsoftware.com/iplm/ - 
    Photos that are not in an iPhoto library can be imported telling iPhoto not to import duplicates (an imperfect procews) and then IPLM can find the duplicates
    As to keeping seperate libraries - only you can do that - IPLM can move photos between libraries for you but only you can know which photos should be in which library
    LN

  • App store tried to update iBooks app. I can only see Newstand app on my screen and cannot get to bookstore. How can I delete and download the iBooks app again. iBook still appears in the settings menu as version 2.1   Tx iPad 2, iOS 5.0.1, iBooks 2.1

    App store tried to update iBooks app. I can only see Newstand app on my screen and cannot get to bookstore. How can I delete and download the iBooks app again. iBook still appears in the settings menu as version 2.1
    Tx
    iPad 2, iOS 5.0.1, iBooks 2.1

    Hi,
    the settings are gone, i guess. But even worse, I cannot get the iPad2 to play Full HD thru the Apple digital AV adaptor using apps that support  (and advertise this), like AVPlayer HD. This definiteley used to work before one of the last iOS upgrades. (I am now at 5.1.1).

  • How can I select and delete the fill color (white background) of a live trace (B&W) with in an actio

    How can I select and delete the fill color (white background) of a live trace (B&W) with in an action set?
    Illustrator CS4 in windows XP.

    Maybe Li[ve trace] is not t]he way[ to go
    I have some suggestion one leave it as is and use a blending mode of multiply to give it a color background like this
    leave it as is make it a grayscale tiff import int Illustrator and color it it in Illustrator like this
    Or trace over it with the brush tool aand then give it a color ground.
    Or do the original over and do a cleaner job with no tone or a minimum of tone. Then Live trace.

  • How can I resize and reposition the Date Created window for All windows?

    When setting view options for a finder window set to list view, I cannot get column resizing or positioning to hold. When making those changes, the option for "All Windows" automatically shifts to "This window only" and it then does not hold.
    How can I resize and reposition the Date Created column for All WIndows?

    Hi Harmz,
    Try dragging this file to the Îesktop & reboot...
    /Users/YourUserName/Library/Preferences/com.apple.finder.plist

  • How can I purchase and download the standalone LR6 here at Hong Kong?  There's no such option for me instead of forcing me to use the CC!

    How can I purchase and download the standalone LR6 here at Hong Kong?  There's no such option for me instead of forcing me to use the CC!

    Try this link:
    http://www.adobe.com/products/catalog.html
    Otherwise I suggest you contact your local office for help:
    Hong Kong office
    Suite 4102, 41/F
    The Lee Gardens
    33 Hysan Avenue
    Causeway Bay
    Hong Kong
    Tel: +852 2916 2100
    Fax: +852 2970 2277

  • How can I check and change the size of photo or doc in iPhone or any other app

    How can I check and change the size of photo or doc in iPhone or any other app

    You would need software form a third party to have this option.  The free software that comes with the 8600 doesn't have an option for that. Vuescan is the only software I could find that says it works with your pritner and has a descreen option.  You have to purchase it, but it will give you more advanced options than the software that came with the printer.
    -------------How do I give Kudos? | How do I mark a post as Solved? --------------------------------------------------------

  • How can i Flash and restore the firmware ( EFI ) from a Macbook pro ( late 2008 , 5.1 ) ??

    How can i Flash and restore the firmware ( EFI ) from a Macbook pro ( late 2008 , 5.1 ) ??
    Please help me !!

    The Seagate backup drive I bought doesn't support 10.5.8
    The only reason I can see for that is it's formatted NTFS, which would likely be Read Only in 10.5.x, if you can reformat it MacOS extended, which would erase everything on it now, then that should work for your purposes.

Maybe you are looking for