get the text of the paragraph?

Hi all

How to extract text perticular single paragraph object.  I've searched the forums and get the paragraph.texts.itemByRange () methods, but I don't know how to use this method to get the text of perticular and I want to delete the text of the paragraph.

I would appreciate for any help to...

Kind regards

Imagine

Sorry, that makes it clearer.

1 itemByRange is useful only when you have the beginning and the end of the range in the form of numbers. What, where you plan to do? Ask in a dialog box from where to where to remove them? The lines "the user has selected" text are just a choice, and you can manipulate that immediately. There is no reason to convert it to a format usable for itemByRange first.

2. at this stage in your stage of learning, should not focus on Getting the * thing at work, rather than focusing on writing elegant, easy to manage, short but not darkened code? All of you who have no meaning if your script does not run.

Tags: InDesign

Similar Questions

  • How to get the paragraph style menu to detach?

    I wish that the paragraph style menu to behave the way the menu character, that is, as its own independent box. Crazy me a little tied to any "other Panel" - no matter what the name of this Panel, it's that it is attached to.

    Thank you very much!

    Just drag it off the coast in the page.

  • Get the parent (paragraph) of the text

    Hi all

    I met a problem and can't seem to find the solution myself. It's like this:

    Let's say you have a story with two paragraphs. A paragraph has 'Hello' in it and the other a 'world' in as text.

    You can select e.g. 'Hello', then click on a button, and then after clicking on the button change for example "Hello".

    So you have a paragraph with "Greetings" and the other with the "world".

    Now, I have the following code I need to change:

    selectedContent var = app.selection [0] .silence; It's selection, "Hello".

    var contentToChange = app.selection [0] .parent; This is the story.

    I want to contentToChange be the paragraph in the text.

    .parent Gets the story, so everything disappears and becomes just "Hello".

    Tried a lot of things, but impossible to find the solution (what should I use instead of 'parent' to get the paragraph).

    Can anyone help please, thank you in advance

    Greetings

    contentToChange = app.selection [0] .paragraphs [0]

    is what you are looking for

  • How to get the current paragraph?

    I now TLF XML:

    private var text: XML =

    " < flow: TextFlow fontSize ="20"paddingRight ="50"paddingBottom = paddingTop"50"="50"paddingLeft ="50"whiteSpaceCollapse = 'preserve' xmlns:flow = ' http://ns.Adobe.com/TextLayout/2008 ">
    < stream: p >
    < flow: span > Hallo Programmili... to the tust Schön langsam meinem koepchen weh liebers < / flow: span >
    < / flow: p >

    < / flow: TextFlow >;

    I try to get the paragraph to a selection within the text to help suite methods:

    var int index = tf.interactionManager.anchorPosition; I have 29 here
    var child: element FlowElement = tf.getChildAtIndex (index); undefined - it should be the element flowElement that contains the text... < span: flow > < / flow: span >
    var para: ParagraphElement = test.getParagraph (); undefined - it should be subsection

    I really started to appreciate the new framework... but now I'm getting really crazy

    Everyone can imagine what I'm doing wrong? The undefined itself makes me suspicious... he should not be null?

    Help would be much appreciated!

    You are confused index and position.

    What you want is:

    var int position = tf.interactionManager.anchorPosition;     It is a position not a clue

    var sheet: FlowLeafElement = tf.findLeaf (position);     map a location on a sheet

    var para: ParagraphElement = leaf.getParagraph ();     find the element leaf to own paragraph

    Also consider whether you want the anchorPosition or the activePosition.  In a selection of points, they are the same.  In a block selection, the anchor is where the block began and the asset is the end changed the user interface (by dragging the mouse and keys).

    Hope that helps,

    RIchard

  • How to get all the fonts in the paragraph?

    Hi all

    Especially in Indesign Javascript list how to get all the fonts section (without a loop in each character).  For example, I used "Minion Pro" to the first character and all other characters are "Zapf Dingbats" fonts. I use code below to get the paragraph font. But it shows only first typeface. If multiple fonts are used for including the paragraph then I need all the list fonts or result "undefined".

    var myPara = app.selection [0] .paragraphs [0];

    Alert (myPara.appliedFont.FontFamily);

    Thank you and best regards,

    Robert S

    var myPara = app.selection [0] .paragraphs [0];

    Alert (myPara.textStyleRanges.everyItem (.appliedFont));

  • How to get the string contents of itemByRange?

    Hi all

    Here's what I'm trying to achieve:

    I selected a Word and you want to get the content of the 1st word in the string (the name of a person).

    1.png

    In fact, the selected text is the source * a hyperlink and my goal is to get the name of the person designated by him.

    [0] is the same as hyperlink.source.sourceText

    Since I can not get the paragraph or line where the selected word is (or simply do not know how to do this), I'm trying to get the full story: from the 1st character of the selected word and moving backward character by comparing its content. When it hits '\r', I know it's the beginning of the line. This way I can get the part of the line, I'm interested with the itemByRange() method, which returns "Array of Character."

    Main();
    
    function Main() {
        var doc = app.activeDocument;
        var sel = app.selection[0];
    
        GetName(sel);
    }
    
    function GetName(txt) {
        var lastCharacter = txt.characters[0];
        var character = txt.characters[0];
        var story = txt.parentStory;
        var index = lastCharacter.index;
    
        while (character.contents != "\r") {
            character = story.characters[index];
            index--;
        }
    
        // Array of Character itemByRange (from: varies, to: varies)
        // Returns the Characters within the specified range. 
        var arr = story.characters.itemByRange(character, lastCharacter);
    
        var str1 = arr.contents[0];
        var str2 = str1.match(/^\S+/);
    
        return str2;
    }
    

    My problem is that I can't get the content- str1 - by script. However, I can see in the data browser that it is there. If I click on str1, it appears:

    2.png

    If I type str1 in the Console, I also get:

    3.png

    I also tried to use:

    arr.getElements)

    arr.getElements () [0]

    .silence arr.getElements () [0]

    etc.

    but that didn't work either.

    I must be missing something very obvious, but I'm stuck. Can someone help me, please?

    Kind regards

    Kasyan

    Hello

    I did something wrong or

    App.Selection [0]. Lines [0]. Words [0] .silence

    is a 1 Word, you are looking for?

    I hope that...

  • How get the text of each paragraph when a textStyleRange is made of texts to multiple paragraphs

    Hello

    Always on my account findText. The result is sometimes as a textStyleRange which contains the texts of multiple paragraphs. What is the best (and easy) way to get the text of each paragraph individually?

    Example: The result of an italic findText with the following extract gives me "saectur quatur? " " Ipsapidunte our" as a unique textStyleRange (correct) but I want to get the text of each paragraph.

    Is there a way to force the findText in the paragraphs and not those of them and if not, how to cut the textStyleRange in 2 texts?

    -----------------------

    Our Ipsapidunte and eumquosame derepre id ulparch iliquae offic tem faccusd aecaborrum, sequi aut doloreperi quaectem eatem faces very quam, con nullaccus repratur molorio enis modi sumquibus nostemquam and volorum facidunti nonseditati re a dolut dolorest ab idipitem saectur quatur?

    Our Ipsapidunte and eumquosame derepre id ulparch iliquae offic tem faccusd aecaborrum, sequi aut doloreperi quaectem eatem faces very quam, con nullaccus nostemquam repratur molorio enis modi sumquibus and re volorum facidunti nonseditati a saectur dolut dolorest ab idipitem quatur?

    There are two solutions:

    (1) you could be formatted every paragraph with formatting marks that you know doesn't exist anywhere else. In this way, each textStyleRange is guaranteed to end at the end of the paragraph.

    (2) you can access the entire first paragraph: myTextStyleRange.paragraphs [0]. I have not tested, but no doubt it works. You could also do a loop: paraLength = myTextStyleRange.paragraphs.length; for (i = 0; i< paralength;="" i++);="" mypara="myTextStyleRange.paragraphs[i];}">

  • I'm doing a script that takes a list of e-mail from a text file and then allow me to select a save as a string. I found some ways to get the path of the file, but I'm in check by pulling the list

    I found some ways to get the path of the file, but I am defeated by pulling the list from that. the function of the path get gives me the path as "Macintosh Users:: Documents: extractedb.txt (myUsername).

    What I can't understand is how to get a dialog box to display a list that represents the content in the text file, I need to change the contents of the text file, I need the box to show me what I chose and I want to save my selection as a single string.
    e '.

    example of extractedb.txt information:

    [email protected]

    [email protected]

    [email protected]

    * has a random number of emails as well *.

    I want this is to pull those emails from the text file and turn them into a list so I can get to be a selection in my dialog box.

    Any help would be great = D

    Assuming you have a text file with your example e-mail addresses, the following AppleScript will read this file in a list (mf_List) and then use this list as input to choose among the list. Because multiple selection is allowed (control button), the output is sent to a list (sel_addr). We check if the Cancel button was pressed by testing for false and if this condition is met, we the script error.  Based on a single or multiple list item content of the list, display accordingly.

    game of mf to ((path to the folder as text) & "mail_list.txt")

    the value mf_List to {}

    the value sel_addr to {}

    the value mf_List to paragraphs of (read file mf)

    the value sel_addr to (choose from the list mf_List with title ¬

    ('Mail list' with multiple selections allowed without empty selection allowed)

    If sel_addr is equal to false then

    Error number-128

    return

    end if

    If length of sel_addr is equal to 1 then

    sel_addr display dialog box as text

    on the other

    the value Point to the text of TID to AppleScript delimiters

    the value Point text in AppleScript return delimiters

    display the dialog box elements of sel_addr in the text

    the value Text of point AppleScript delimiters to TID

    end if

    return

  • How to get the current line or the entire paragraph?

    Hello.

    I am facing the following problem:

    Suppose I have the following in FrameMaker:

    It is a sentence. And (end of single line)

    There also this sentence. (end of paragraph)

    It is a sentence. And (back)

    There also this sentence. (end of paragraph)

    It is a sentence. And (end of single line)

    There also this sentence. (return)

    But there is also this sentence (end of paragraph)

    It is a sentence. And (end of single line)

    There also this sentence. (return)

    There also this sentence. (return)

    But there is also this sentence (end of paragraph)

    What I want is this:

    Download the text of the entire paragraph where the insertion point of the cursor is.

    However, when exist from the ends of the hard line I want to change their behavior.

    This is the behavior to the foregoing:

    For the first example of the paragraph if the cursor is either first or second line I want to get the whole paragraph.

    Paragraph if the cursor is in the first line, I want only the first line. And if it's in the second row, I want only the second line.

    The third paragraph if the cursor in the first or second line, I want the first and second lines must be retrieved in plain text. Also, if the cursor is in the third line I want only to the third line.

    For the fourth paragraph, it functions as the third paragraph. If the cursor is in the third row I get only this one.

    Could you please provide of the FDK in C++ to start with code?

    It's a puzzle.

    As you are in the forum script, I am related to this here. You must understand the FDK C++ code yourself.

    There's not much to tease my brain with it. You get the point where the cursor is and pick up the pieces of text more line via the GetText() method, using a bit field which includes the FTI_String and the FTI_LineEnd. Each end of the line has a modifier that tells you if it's a hard or a return. You also get the offset in the paragraph of the current position of the cursor, and then create the necessary strings from the array of items of text returned by the GetText method.

    If you want the full execution of the code, ask someone to program it for you and be prepared to pay for the work.

    Good luck

  • How can I get the current paragraph?

    I want to get the current paragraph where the insertion point is.

    How can I do this in FDK?

    Ch,

    I can answer some of these questions, but if you have decided that this thread is replied, please give credit to Mike.

    About the audit for a FO_Pgf object, you shouldn't have that. I think that there is some obscure cases where F_ApiGetTextRange() gives you an object that is not a paragraph... I forgot exactly but I think it has to with a text graphic subject line or something like that. I could be wrong. In any case, if you have a stream of regular text with an insertion point, you will get a paragraph object.

    This line will abort the operation if any text is selected. Do you really want that?

    If (insertionPoint.beg.objId! = insertionPoint.end.objId)

    This line will abort the operation if several paragraphs are selected. Do you really want that? Without this verification, you will always get the text of the first selected paragraph.

    If (insertionPoint.beg.offset! = insertionPoint.end.offset)

    Otherwise, the code looks OK to me, at least regarding the FDK calls. You have problems with him?

    Russ

  • How to get the text formatting in the tables

    Dear experts and aid

    For my project, I import an RTF file and then read the data into 3 tables. It works fine when just using the contents of the string of paragraphs. However, the final script should be able to read and to replace the text formatted...
    Why use intermediate tables? Because otherwise I need to swap between two fm-documents (and you can be a part of the book).

    The imported file starts with a certain number of lines separated into two parts by a TAB ("designates a TAB in \x08 FM)
    [[Garneau, 1990 #12]]    »   [9]
    The good article can also be locally as text, e.g. [9]
    Then follow the same (or smaller) number of paragraphs with text formatted like this:
    [9]"D. Garneau, ed., National Language Support Reference Manual (national language Information Design Guide. Toronto, CDN: IBM National Language technical Centre, 1990.

    Is it possible to replace in the body of the function below the next song

      while(pgf.ObjectValid()) {
        pgfText = GetText (pgf, newDoc);
        gaBibliography.push(pgfText);
        pgf = pgf.NextPgfInFlow;
      }
    

    with this

      while(pgf.ObjectValid()) { 
        gaBibliography.push(pgf);
        pgf = pgf.NextPgfInFlow;
      }
    

    Do I need a special statement of the gaBibliography range?
    And how to get the right part of the lines as formatted intro thingy in table gaFmtCitsFmt ?

    Currently, I read in the tables as "strings" (function GetText not shown):

    var gaFmtCitsRaw  = [];                           // left column in processed RTF
    var gaFmtCitsFmt  = [];                           // right column in processed RTF
    var gaBibliography= [];                           // bibliography lines from processed RTF
    // filename is something like E:\_DDDprojects\FM+EN-escript\FM-testfiles\BibFM-collected-IEEE.rtf 
    
    function ReadFileRTF (fileName) {
      var nCits=0, nBib = 0, openParams, openReturnParams, newDoc, pgf, pgfText ;
      var TAB = String.fromCharCode(8);               // FM has wrong ASCI for TAB
      var parts = [];
      
      openParams = GetOpenDefaultParams();
      openReturnParams =  new PropVals();  
      newDoc = Open (fileName, openParams, openReturnParams);  
      pgf = newDoc.MainFlowInDoc.FirstTextFrameInFlow.FirstPgf;  // get first pgf in flow
    
    // --- read the temp/formatted citations  
      while(pgf.ObjectValid()) {
        pgfText = GetText (pgf, newDoc);
        if (pgfText.substring (0,2) == "[[") {        // citation lines start with [[
          parts = pgfText.split(TAB);                 // get the two parts of the line
          gaFmtCitsRaw.push (parts[0]);               // Push the result onto the global array
          gaFmtCitsFmt.push (parts[1]);
          pgf = pgf.NextPgfInFlow;
        } else { break }
      }
    
    // --- read the bibliography
      while(pgf.ObjectValid()) {                      // until end of doc
        pgfText = GetText (pgf, newDoc);
        gaBibliography.push(pgfText);
        pgf = pgf.NextPgfInFlow;
      }
      newDoc.Close (Constants.FF_CLOSE_MODIFIED);
    } // --- end ReadFileRTF
    

    The following questions will then be how to change the script of FindAndReplace of Ian Proudfoot for managing text formatted as replacement. I will need to use the copy and paste IMHO...

    Klaus, okay, before pasting, you must assign the TextSelection object at your insertion point.

    // Add a new paragraph after the current paragraph.
    var newPgf = oDoc.NewSeriesPgf (lastPgf);
    var textRange = new TextRange (new TextLoc (newPgf, 0), new TextLoc (newPgf, 0));
    
    oDoc.TextSelection = textRange;
    oDoc.Paste ();
    

    -Rick

  • How to get the bounding box of the text element boundaries.

    Hi all

    I try to get the boundaries of the bounding box of the text of paragraph element. I found the following link,

    the coordinate of a bounding box is the same as the coordinates of the layer?

    But the solution does not work for me. It is for me as the layer of destination each time that is the limits of the actual text.

    Can someone have an idea how to do this?

    Thank you.

    Ok.. Looks like these settings that if the upper line of fonts is calculated from the highest point of the highest glyph or above the normal uppercase and can go above this. What is it changes by the police?  And if the exchange difference, the bottom of the bounding box moves it or increase the height?

    Discover the values limits-descriptor, especially 'top '. I think that it used to have small values of values that could be the delta of the value of the position. Note that there might be the scaling issue that I explained earlier

    Var ref = new ActionReference()

    ref.putEnumerated (charIDToTypeID ("Lyr"), charIDToTypeID ("Ordn"), charIDToTypeID ("Trgt"))

    var action = executeActionGet (ref)

    var textKey = action.getObjectValue (stringIDToTypeID ('textKey'))

    var limit = textKey.getObjectValue (stringIDToTypeID ('bounds'))

    Top Var = bounds.getUnitDoubleValue (stringIDToTypeID ('top'))

    var left = bounds.getUnitDoubleValue (stringIDToTypeID ('left'))

  • I want to get all the paragraphs in a document

    Hello

    I want to get all the paragraphs of a document (document has table and cell and it contains a few para as well)

    Here is my script.

    var objDoc = app.activeDocument;

    var objDocName = objDoc.fullName.toString ();

    var a = objDoc.stories.everyItem ().paragraphs.everyItem () .getElements ();

    var paraLength = per .length;

    $.writeln (paraLength);

    for (j = 0; j < par.length; j ++)

    {

    $.writeln (j);

    var text = nominal .silence [j];

    var IpFin [j] =.insertionPoints.firstItem ();

    var endTF = endIP.parentTextFrames [0];

    var endCitationPage = endTF.parentPage;

    var index = endCitationPage.index;

    var offset = endCitationPage.documentOffset;

    ~ $.writeln (text + "Page:" + endCitationPage.name);

    ~ $.writeln (index);

    }

    This script does not give me the text which is part of the cells.

    Is there a property where we can get all the para doc as:

    var a = objDoc.paragraphs.everyItem () .getElements ();

    Try this,

    var objDoc = app.activeDocument;
    var par=objDoc.stories.everyItem().paragraphs.everyItem().getElements();
    var paraLength=par.length;
    $.writeln(paraLength);
    var b = 0;
    for (j = 0;j=1)
            {
                    var a = j;
                    for(var i=0;i
    

    Kind regards

    Cognet

  • [CS5.5] [JS] how to get the object that is anchored by a text search result?

    Hello

    I need to get the object that is anchored by a text search result. It can be an image, textframe, group objects...

    It's my code...

    app.findTextPreferences = NothingEnum.nothing;

    app.findTextPreferences.findWhat = "< FFFC > ';

    var myResults = app.activeDocument.findText ();

    var currentParagrapfNum = - 1;

    for (var n = 0; n < myResults.length; n ++) {}

    var currentResult = myResults [n];

    currentParagrapfNum = currentResult.paragraphs [0] .index;

    var currentAnchoredObject =? ;

    currentAnchoredObject.anchoredObjectSettings.horizontalReferencePoint = AnchoredRelativeTo.TEXT_FRAME;

    currentAnchoredObject.anchoredObjectSettings.verticalReferencePoint = VerticallyRelativeTo.LINE_BASELINE

    }

    Can someone help me please?

    Thanx

    Yes, true, ^ anchor of finds, but they are of type character. What you need is

    myResults[n].pageItems[0].anchoredObjectSettings.horizontalReferencePoint = AnchoredRelativeTo.TEXT_FRAME;

    Peter

  • How to create link for reference to the paragraphs or text anchor to another indesign file?

    Hello

    I'm new in indesign scripting.

    I want to create the reference, which is the link to the paragraphs (or text anchor) another indesign file (new.indd).

    My first problem is how to get all the paragraphs or anchor text of the file new.indd

    I have a TextFrame whose content is Adobe Indesign.

    I want to apply an Adobe Indesign link reference to the paragraphs with the Destination Documents: new.indd.

    How it's done by script?

    I have try to use this:

    indesign #target

    myDocument var = app.documents.add ();

    var myTextFrame = myDocument.pages.item (0).textFrames.add ();

    myTextFrame.geometricBounds is ['10', 15 ' p', '30', '35p'];.

    myTextFrame.contents = "Adobe Indesign";

    var text = myTextFrame.texts.firstItem ();

    var hyperlinkURLDestination = myDocument.hyperlinkURLDestinations.add ("C/Documents and Settings/Administrator/Desktop/new.indd");

    var DestinationDoc = hyperlinkURLDestination.parent ();

    var xRefForm = myDocument.crossReferenceFormats.item ("Page number");

    source var = myDocument.crossReferenceSources.add (text, xRefForm);

    var myLink = myDocument.hyperlinks.add (source, hyperlinkURLDestination);

    When I run this script it gives error "the destination is not valid. You can create Cross - reference to anchor text or destination of the paragraph.

    How to get all the Paragrapgs or text the file new.indd anchor and create cross-references using the this.

    Thank you.

    You can create cross-references to anchor points and paragraphs. If you need create an anchor text in new.indd, then use as the target of the cross reference:

    var anchor = app.documents.item ('new.indd').hyperlinkTextDestinations.item ('myAnchor');

    source var = app.activeDocument.crossReferenceSources.add (text, xRefForm);

    app.activeDocument.hyperlinks.add (source, anchor);

    Peter

Maybe you are looking for

  • Firefox Sync does not work for Tablet Android Nexus 10.

    Firefox Sync works for 2 PCs, but does not work for an Android tablet. It is said, that the tablet was connected successfully, I checked the bookmarks and history options to be synchronized and or bookmarks, or history of the browser has not been upd

  • Windows 7 screen goes black

    A PC brand new, all updates, installed the latest version of Skype. When I make a call the screen call comes in then the screen goes black, no video running and so the screen turns off. No keyboard input or mouse entries don't work back on screen. Th

  • HP Compaq dx2400 microtour format: video card - motherboard compatibility

    Hi, first I want to sorry my bad English because I'm Romanian. My question is: I have a HP Compaq dx2400 microtour and I want to know if AMD R7 240 1 GB ddr5 Sapphire, it will be able to run on my pc. Thanks in advance!

  • Update SP1 of XP to SP3 - language problems?

    I have an old IBM stationairy pc with XP SP1 and I want to upgrade to SP3. I try to install SP1a, SP2, and SP3, but each ONE of them comes up with the same error message: "The installation program nannot yout update Windows XP files because the langu

  • WinSAT error

    I have dell inspiron 1501 with windows 7 ultimate 32 bits of the operating system, but there is a problem with the evaluation of the system whenever I tried to note I received an error message as windows system assessment tool stopped working.please