Applescript: Working with text

My script finds blocks of text which are have the character style "CS-Descriptor":
tell application "Adobe InDesign CS5"
set applied character style of find text preferences to "CS-Descriptor"
          tell document 1
                    set myDescription to find text
          end tell
  end tell
This returns, e.g.
{text from character 1807 to character 1818 of story id 21888 of document id 19 of application "Adobe InDesign CS5"}
I now need to find more information about the immediate surroundings of this piece of text. Somehow I want to find out something like the paragraph number, or line number, so that I can find the first word of the line.
Can anyone help me get from 'text from character......' to 'paragraph 52 of text flow.... ' or something similar?
So far scripting ID my experience has been that it is much, much easier than I think! Fingers crossed it is again.
Sorry about Applescript - it seems to be dying out!
Emma

Cooroo wrote:
This returns, e.g.
{text from character 1807 to character 1818 of story id 21888 of document id 19 of application "Adobe InDesign CS5"}
I now need to find more information about the immediate surroundings of this piece of text. Somehow I want to find out something like the paragraph number, or line number, so that I can find the first word of the line.
You can just ask for :
          word 1 of paragraph 1 of myDescription
Getting the paragraph number is a bit trickier:
  count of paragraphs of text from character 1 of parent story of myDescription to character 1 of myDescription
Sorry about Applescript - it seems to be dying out!
Nothing to apologise for -- reports of its death have been greatly exaggerated.

Similar Messages

  • Caller ID - does it work with text messages?

    hi there , I set up callerID.
    tried to call a number in malaysia, the callerID doesn't show up. perhaps it varies from country to country
    however, what I really want to know is, does caller ID work with text messages? I send SMS Thru skype, and the receiver will see the caller ID ?

    I unfortunately have not found anything out.  I also have since purchased a 2011 Nissan Murano and still have the Rogue.  From time to time in the Rogue the caller ID works, but it paired ok after several tries with my Murano and the caller ID seems to work, but I dont drive that vehicle daily its my husbands.  I wish Apple would do something to fix this bluetooth issue everyone else I know with a Nissan and bluetooth does not have this issue its totally something to with Apple.  My Murano does not have Nav its only an SL.  Good luck!

  • Select/transform tool changes to pan tool when working with text

    I have had this problem since Motion 2, and version 3 is no different. Whenever I work with text in Motion, at some point while moving the text in the canvas, the select/transform tool will suddenly change into the Pan tool, and it won't let me do anything else but pan things. I have to close and reopen Motion to correct this. It happens VERY OFTEN, every time I work with text...it get's really annoying haveing to conatantly quit and reopen the program. I lose a lot of time doing that. Has anyone else had this problem? I also have a Powermac G5 that has the same problem so I know it's not the Mac Pro. Any suggestions?

    Sounds familiar.
    I searched and saw a couple posts from Patrick that suggested,
    "This seems to happen after adjusting text. Simply click on the canvas and press space. The project won't play and the hand will turn into your selected tool."
    see:
    http://discussions.apple.com/thread.jspa?messageID=2249852&#2249852
    http://discussions.apple.com/thread.jspa?messageID=4299262&#4299262

  • InDesign CC is performing poorly, slowly when working with text.

    InDesign CC is performing poorly, slowly when working with text. I tried updating and it seems like everything installed except for Extension Manager 6.0.7 which failed to instal. Any fix for this?

    Thanks, I think the problem is solved. Previously, the CC Extension Manager failed to install when I did an update via the InDesign Help menu. InDesign CC updated successfully, however, InDesign was still acting wonky. Since downloading a new full CC Extension Manager a little while ago, InDesign seems to be working better. Is there a correlation between the two apps for future reference?

  • How do we work with Text Frames in a structured xml template

    Hi ,
    I am working with structured template using Framemaker 7.2. I need to add Text Frame in the structured template. Could you please tell me how do I add text frame with the body page of a strcutred template.
    Thanks
    Manas.

    Hi Manas,
    Text frames work the same whether the template is structured or unstructured. The only thing you should be aware of is that a text frame creates another flow, which can be structured or unstructured. In either case, you will not be able to export its contents to XML. You didn't mention XML specifically, just thought I would note that.
    Do you need general instructions on inserting a text frame? If so, I think the user guide should have that.
    Russ

  • Which Bluetooth headsets work with texting on iPhone 4S?

    I have a Motorola Bluetooth earpiece that I bought with my Droid x and it worked with reading texts and answering them, but I have not found any app that allows me to do the same thing on the iPhone.  Is it just the headset or is there no app that does that?

    if you have siri she should be able to access messages and read them  just activate her and say read/send text  only bt headset i know of that accesses siri is motorola elite sliver

  • ODBC Driver won't work with text 4k

    Hi,
    Using ODBC, I am trying to populate a CLOB columnn with text over 4K in size, and I recieve an error. Is there a way I can workaround this by adding the data in chunks or using binding (I am usnure how to do this in ADO).
    Thanks
    Rich.

    Generally, the 4k limitation comes up when you're trying to execute a statement with a really long string in it (i.e. insert into foo ('some 4k+ string') ). Oracle has a limit of 4k for string literals.
    The way to get around this for CLOB's is, as you suggest, to execute a statement with bound variables and then bind the 4k+ data to those variables (i.e. insert into foo (?) ), then doing a SQLBindParameter of the 4k string.
    Justin

  • New bee looking for applescript help with text edit app

    I have a huge text files (20+) , I want to find a list of words like weather, farmers, ploughing. I want to find these words one at a time, as my text file is 250+ Mb in size.
    I want applescript to count the how many times each word appears in the text.
    Paste that occurrence of word into an spreadsheet file in a row named after text file , and in a column named weather, farmers, ploughing.
    Please help.
    Thanks much.
    CF
    PS so far I can open the text files with applescript, that is about the extent of my ability in programing.
    Message was edited by: coldfusions onco

    For a file of that size, you would need to use some shell utilities to get decent performance. To count words, the following script breaks up the text into words, then counts the number of times the specified word is found (a dictionary file is used as an example, so the match is equivalent to 'contains'):
    <pre style="
    font-family: Monaco, 'Courier New', Courier, monospace;
    font-size: 10px;
    font-weight: normal;
    margin: 0px;
    padding: 5px;
    border: 1px solid #000000;
    width: 720px;
    color: #000000;
    background-color: #DAFFB6;
    overflow: auto;"
    title="this text can be pasted into the Script Editor">
    set theFile to "/usr/share/dict/web2" -- a 2.5MB list of words
    set someWords to {¬
    {theWord:"weather", theCount:0}, ¬
    {theWord:"farmers", theCount:0}, ¬
    {theWord:"ploughing", theCount:0}}
    repeat with anItem in someWords
    set aWord to quoted form of theWord of anItem
    try -- break up into individual words, then search and count
    set theCount of anItem to (do shell script "tr -cs '[:alpha:]' " & quoted form of linefeed & " < " & theFile & " | grep -ic " & aWord) as integer
    end try
    end repeat
    someWords
    </pre>
    Is this related to your Automator post?

  • Working with Text in A/W

    Hi,me again.I'm trying to make five .jpg s turn into one comprehensible image.I saved a recipe page from web,it wouldn't do what I wanted,so I screenshotted it,took 5 shots to get it all.I think A/W is the choice to make it all come together,but maybe I should try Text Edit?I'm not really into typing so much,this is all done with one finger.Oh,maybe as drawing?Instead of Word Processing?I'll try that after breakfast if I get some more computer time.
    The webpage shows the recipe as long columns you have to scroll down to view.I want to make it wrap to page,but with separate jpegs,it's not working for me.Idiots don't even know how to present recipes,and they're supposed to be experts.

    Hi Linda, just a note from one non-typist to another, that if you hit the spacebar after typing punctuation like a period, or a comma, it will make your text much easier easier to read, and not so breathless.
    If you can get back to the original recipe webpage, you should be able to select and copy (Command-C) the text you want (do pictures separately) just as you would in any text document. If you haven't yet emptied the Trash, you might be able to retrieve the saved webpage you mentioned and do the same w/ that. Either way you should then be able to paste (Command-V) that text into a new, blank AW word processing (WP) (or TextEdit) document you've created. Then you can edit the text to suit your needs.
    Clever of you to think of the screenshots, but they only give you pictures of the page, and no access to the text itself as you have discovered. You could conceivably copy and paste one line at a time into a new picture and get what you want that way, but what a time waster.
    Finally, here's somthing I just discovered (old hat to many, I'm sure) you can do if Safari's your browser: Selelect some stuff (or Command-A to Select All) on the web page you're looking at; navigate through Services to TextEdit under the Safari menu (Safari>Services>TextEdit>New window containing selection) The TextEdit window you get will have both pix, if any, and completely separate text, both editable. In fact you'll have to edit because the stuff's just the raw building blocks of the web page. Save it as something and go to it.

  • Working With Texts.

    I have AE CS3. When I first got it I could put texts on the screen and put an animate in AND an animate out effect to the text for title screens for my Premiere projects.
    Now for some reason I can only put one effect to the same set of texts. As long as the effects didn't overlap, I could put quite a few effects, but no more. Anyone with any ideas as to what I might have done to mess up my work area?

    Effects? You mean animation presets, don't you? It's not quite clear what you are doing, but keep the following in mind:
    a) presets will be applied at the current time marker applying them at the wrong time will anturally make them appear to be defunct
    b) text animators work accumulatively. It is quite possible that one cancels ou the other if some of their parameters ahve the exact same timing, just with opposite values
    c) some of the presets use similar or identical effects controls. It is possible that because of the identical names some of the expressions used do not function as expected
    Check these things. If you still can't get it to work in the way you expect, then simply split the layers.
    Mylenium

  • Will Applescript work with Photoshop CC2014?

    I am trying to write an applescript that will take the FileInfo>keywords and append it to the FileInfo>description but I'm not having any luck. Has anyone been able to do something similar?

    It should work on a Mac.  You may want to search the Photoshop Scripting forum.  Though most use javascript to support Mac and PC.
    Here is a simple javascript wrote to save and restore the foreground and background color swatches  to be user in actions so the action could mess with the color and restore the user colors.    The document metadata field  instructions is used as as scratch pad. You should be able to see how mete data is addressed in javascript
    /* ======================================================================================
    // 2009  John J. McAssey (JJMack)  http://www.mouseprints.net/
    // This script is supplied as is. It is provided as freeware.
    // The author accepts no liability for any problems arising from its use.
    // This script is designed to be used by a Photoshop Action twice
    // A good pratice to use when creating an actions that use this scipt is for the action
    // not to do a save or play some other action between its two useages of this Script.
    // The first time this script is used by an action Photoshops Current Forground
    // and Background Colors are saved into the document's meta-data Info Instructions field.
    // The second time this script used by the action the script retreives what was
    // saved in the meta-data during the first usage and these colors are set.
    // and the saved data is removed from the document's meta-data Info Instructions field.
    // ===================================================================================== */
    <javascriptresource>
    <about>$$$/JavaScripts/SaveAndRestoreColors/About=JJMack's SaveAndRestoreColors.^r^rCopyright 2009 Mouseprints.^r^rRun twice script utility for action.^rNOTE:Don't play other actions between runs!^r^rFirst Run records Photoshops foreground and background swatch colors.^rSecond Run restores the recorded colors and removes the recording.</about>
    <category>JJMack's Action Run Twice Utility</category>
    </javascriptresource>
    if (app.documents.length > 0) {
      if (app.activeDocument.info.instructions.indexOf("<Colorf>") == -1 ){ // no footprint fisrt useage
      //alert("first");
      // Retreive Document information for Foot Print
      saveforeColor = new SolidColor;
      saveforeColor.rgb.red = app.foregroundColor.rgb.red;
      saveforeColor.rgb.green = app.foregroundColor.rgb.green;
      saveforeColor.rgb.blue = app.foregroundColor.rgb.blue;
      savebackColor = new SolidColor;
      savebackColor.rgb.red = app.backgroundColor.rgb.red;
      savebackColor.rgb.green = app.backgroundColor.rgb.green;
      savebackColor.rgb.blue = app.backgroundColor.rgb.blue;
      // put footprint in metadata info instructions
      app.activeDocument.info.instructions = app.activeDocument.info.instructions + "<Colorf>" + saveforeColor.rgb.red + "," + saveforeColor.rgb.green + "," + saveforeColor.rgb.blue + "</Colorf>" + "<Colorb>" + savebackColor.rgb.red + "," + savebackColor.rgb.green + "," + savebackColor.rgb.blue + "</Colorb>";
      //alert( "Saved ="  + "<Colorf>" + saveforeColor.rgb.red + "," + saveforeColor.rgb.green + "," + saveforeColor.rgb.blue + "</Colorf>" + "<Colorb>" + savebackColor.rgb.red + "," + savebackColor.rgb.green + "," + savebackColor.rgb.blue + "</Colorb>");
      else {
      //alert("second");
      // Retreive saved information
      colorfOffset = app.activeDocument.info.instructions.indexOf("<Colorf>") + "<Colorf>".length;
      colorfLength = app.activeDocument.info.instructions.indexOf("</Colorf") -colorfOffset;
      saveforeColor = app.activeDocument.info.instructions.substr(colorfOffset, colorfLength);
      colorbOffset = app.activeDocument.info.instructions.indexOf("<Colorb>") + "<Colorb>".length;
      colorbLength = app.activeDocument.info.instructions.indexOf("</Colorb") -colorbOffset;
      savebackColor = app.activeDocument.info.instructions.substr(colorbOffset, colorbLength);
      //alert("Colorf = " + saveforeColor + " Colorb = " + savebackColor );
      // Restore Colors
      app.foregroundColor.rgb.red = saveforeColor.substr(0,saveforeColor.indexOf(","));
      saveforeColor = saveforeColor.substr(saveforeColor.indexOf(",") + 1,saveforeColor.length);
      app.foregroundColor.rgb.green = saveforeColor.substr(0,saveforeColor.indexOf(","));
      saveforeColor = saveforeColor.substr(saveforeColor.indexOf(",") + 1,saveforeColor.length);
      app.foregroundColor.rgb.blue = saveforeColor ;
      app.backgroundColor.rgb.red = savebackColor.substr(0,savebackColor.indexOf(","));
      savebackColor = savebackColor.substr((savebackColor.indexOf(",") + 1),savebackColor.length);
      app.backgroundColor.rgb.green = savebackColor.substr(0,savebackColor.indexOf(","));
      savebackColor = savebackColor.substr(savebackColor.indexOf(",") + 1,savebackColor.length);
      app.backgroundColor.rgb.blue = savebackColor ;
      // Remove footprint from metadata info instructions
      before = app.activeDocument.info.instructions.substr(0,app.activeDocument.info.instructions.indexO f("<Colorf>"));
      afterOffset = app.activeDocument.info.instructions.indexOf("</Colorb>") + "</Colorb>".length;
      after = app.activeDocument.info.instructions.substr(afterOffset, app.activeDocument.info.instructions.length - afterOffset);
      //alert ("before = " + before + " after = " + after);
      app.activeDocument.info.instructions = before + after;
    else { alert("You must have at least one open document to run this script!"); }

  • 1 of 5 custom tones won't work with 'Text Tone'

    I have managed to create 5 custom tones that are now on my iPhone 5. All five of the tones work for the 'Ringtone' but only 4 out of the 5 work for the 'Text Tone'.
    This is more about a challenge to find the reason than anything else, because I can get by without the the 5th one working for the 'text tone', but it happens to be the one that is the most relevant for the 'text tone', being "I've gotta get a message to you" by the Bee Gees.
    When I select this particular tone for the 'text tone' the phone does not make a sound, but it vibrates as I have the 'Vibration'  setting set to 'Alert'.
    So, does anyone want to take up the challenge to solve this situation?

    Thanks for the advice. I re-did this particular tone for a length of 25 seconds and it now works. Weird that the other 4 work @ 30 second lengths.  Anyway, thanks again, as I wouldn't have done this without your reply.

  • Every since ios8 my camera is not working with text or with other apps that worked flawlessly before. I just get a black screen when I go to take a photo.

    Ever since downloading ios8 onto my 5S the camera isn't cooperating with other apps--messages, Freshbooks in particular.  What's up with that? Very frustrating!

    MacBook Pro  / Mozilla Firefox / Netflix / Silverlight Update solved - DON'T DWNLOAD FROM NETFLIX
    I solved this problem tonight. I have a MacBook Pro with 10.5.8. I know, it's old. But I love my Netflix and I recently noticed that Firefox plays Netflix much better.  Then I suddenly got this message that I needed to download the latest Silverlight - it only takes 30 seconds! - WRONG.   However, after much searching, I finally did the steps in order and it worked.  
    This was after repeatedly downloading Silverlight from the Netflix site without success.  So here's what I did:
    1. Went to http://www.microsoft.com/getsilverlight/Get-Started/Install/Default.aspx
    2. Followed the directions. I felt like such an idiot for not doing it right before.
    3. Go to your hard drive and search for "Silverlight" to locate ANY existing Silverlight files: .dmg, etc.
        [also check your Libary/ Internet Plug-ins, but the above search is faster]
    4. Drag it all to the trash and empty it.
    5. Go back to the Get  Silverlight page and click on the Install on that page, not the Netflix site.
    6. Note the steps for Safari or Mozilla Firefox - I wanted Firefox, so I follwed those instructions.
    7. Once it's installed, close all the browsers and Restart that bad boy. Right away.
    8. Open a browser, go to Netflix and proceed to joyfully rot your brain with Netflix content. Yay!

  • How to work with text objects in b2b frontend

    Hi,
    My functional team has assigned new text ids "0012","Z005" and "Z025" in text object "CRM_ORDERH"
    and text procedure "ZORDER02".
    Now they want me to add five new text input fields to b2b order creation page and they want the data entered by customer to be saved under these text ids.
    Suppose there are five fields A,B,C,D and E.Now they want me to send the contents of A under "0012"
    and concatenation of rest of four fields to "Z005" and "Z025".
    I have no clues what all I need to do.Can anyone please let me know what all I need to write and how to get this requirement done.
    Thanks in advance

    Hi Laxman,
    Thanks for the quick turn around.
    I dont get it in the get_head method. I am doing a crm_order_read and reading the output text table.
    It has two text ids instead of three which i updated in change_head method.
    I checked in debugging in the text_maintIn_ow function module and
    i saw that this text id was failing to get updated , the message "Z* text id not maintained in procedure Z100001'. This procedure is assigned to TA and the text id id not assigned to TA. The process type is still TA the first time CRM_ORDER_MAINTAIN is called along with these extension updates. So the text maintain function gets the control data for TA and not for the ZPRO process type.
    I have all the text ids maintained for process type ZPRO.
    Here is the code when the user selects the process type ZPRO in ISA from the basket page.
    And in our case we dont have any payment method page in ISA after this selection.
    Code:
    Change_head
    READ TABLE ct_orderadm_h INTO ls_orderadm_h INDEX 1.
      CHECK sy-subrc = 0. " and ls_orderadm_h-process_type = 'ZPRO'.
    LOOP AT it_extension INTO ls_extension WHERE ref_guid EQ ls_orderadm_h-guid.
          CASE ls_extension-name.
    * Comments
            WHEN 'ZCOMMENTS' OR 'ZPUR_EMAIL' OR 'ZCC_EMAIL'.
              CALL METHOD fill_text
                EXPORTING
                  iv_language     = lv_language
                  is_orderadm_h   = ls_orderadm_h
                  is_extension    = ls_extension
                CHANGING
                  ct_text         = ct_text
                  ct_input_fields = ct_input_fields.
          ENDCASE.
        ENDLOOP.
    ** get_head_get_data*
    APPEND is_basket_head-guid TO lt_header_guid.
      ls_req_obj = 'ORDERADM_H'.
      INSERT ls_req_obj INTO TABLE lt_req_obj.
      ls_req_obj = 'PARTNER'.
      INSERT ls_req_obj INTO TABLE lt_req_obj.
      ls_req_obj = 'TEXTS'.
      INSERT ls_req_obj INTO TABLE lt_req_obj.
      ls_req_obj = 'STATUS'.
      INSERT ls_req_obj INTO TABLE lt_req_obj.
      CALL FUNCTION 'CRM_ORDER_READ'
        EXPORTING
          it_header_guid = lt_header_guid
          iv_only_spec_items = 'X'
          it_requested_objects = lt_req_obj
        IMPORTING
         et_orderadm_h        = lt_orderadm_h
    *      et_customer_h        = lt_customer_h
           et_partner           = lt_partner
           et_text              = lt_text
    *      et_sales             = lt_sales
          et_status            = lt_status
        EXCEPTIONS
          OTHERS               = 99.
      IF sy-subrc <> 0.
      ENDIF.
    * check
      READ TABLE lt_orderadm_h INTO ls_orderadm_h INDEX 1.
      CHECK sy-subrc = 0 . "AND ls_orderadm_h-process_type = 'ZPRO'.
      ls_ext-ref_guid = ls_orderadm_h-guid.
      ls_ext-ref_type = 'A'.
    * TEXTS
      LOOP AT lt_text INTO ls_text WHERE stxh-tdobject EQ 'CRM_ORDERH'.
        CALL FUNCTION 'CONVERT_ITF_TO_STREAM_TEXT'
          EXPORTING
            lf          = ' '
          TABLES
            itf_text    = ls_text-lines[]
            text_stream = lt_text_stream.
        CASE ls_text-stxh-tdid.
          WHEN 'Z003'.
            ls_ext-name = 'ZCOMMENTS'.
          WHEN 'ZEML'.
            ls_ext-name = 'ZPUR_EMAIL'.
          WHEN 'ZECC'.
            ls_ext-name = 'ZCC_EMAIL'.
          WHEN OTHERS.
            CONTINUE.
        ENDCASE.
        READ TABLE lt_text_stream INTO ls_ext-value INDEX 1.
        APPEND ls_ext TO ct_extension.
      ENDLOOP.
    Edited by: sri226 on May 9, 2009 6:05 PM
    Edited by: sri226 on May 9, 2009 6:12 PM
    Edited by: sri226 on May 9, 2009 6:12 PM
    Edited by: sri226 on May 9, 2009 6:13 PM

  • About Working with text descriptors (tags)

    Hi, I see the Text Tracks tutorial for QT Pro, so I decide to make some subtitles for a video and change the color of the text, but the tuto say about RGB colors an the numbers that fills are 5 digits. But I learned that RGB only uses a scale of 0-255 to fill all the colors, So how can i get the most common colors or is there an algorithm or some kind of these to obtain other colors like say pinkish, redish or greenish??
    I only want a yellow color for the subtitles, but I've interested on the way to obtain more colors, so if anybody knows, please tell me. I really appreciate it!!

    Yep. Very confusing and you need a calculator to figure them out.
    http://discussions.apple.com/thread.jspa?messageID=3652488&#3652488
    But someone did it for us.
    I wish Apple would put the "Color Wheel" (version 6) and some of these other options back into version 7.
    http://homepage.mac.com/kkirkster/03war/
    One of my "movies" that uses the text track feature found in QuickTime Pro.
    And, I used a "yellow" color for the text track.

Maybe you are looking for

  • ICAL & TO DOS

    Why do to dos always disappear from I-Tunes. For example, I was at work Friday and created a to do list for the up coming week today monday no to dos appear in the list?? Please advise.

  • What is it with iMacs eh? If it's not one thing it's another.

    Okay, nothing disasterous, but annoyances that mount up. To cut a long story short, I started off on a Mac mini, and was so impressed I decided I wanted something with more oomph, so got took it back to the store within 10 days and traded up to a 20"

  • Actions in Photoshop Elements 10?

    I'm trying to figure out how to use actions, it looks like it's a great way to edit photos. I'm watching youtube videos and they all say "go to window" and "actions" bar. I did that and when I went to window there was no actions bar? Is that somethin

  • ZEN Vision M to amplif

    I was wondering if anyone of you can share some expiriences concerning the music quality of this player when connected to an hifi amplifier via the AV docking station? Is the quality far less than a cd player thats hooked up by optical cable? It's a

  • SCSM 2012 -

    In SQL Report Builder I have put in the Problem.dom so I can see all of the below fields, see also the screen shot. How can I amend this code so that I can see everything listed in the Problem.dim as below but also the UserDim?  I need this as i want