2 Replies Latest reply on Jan 24, 2015 3:09 AM by hamdifem

    A simple question

    hamdifem Level 1

      I want to delete my space back to add a point

       

      app.selection[0].texts[0].insertionPoints.item(-1).contents = " ";

      app.selection[0].texts[0].insertionPoints.item(0).remove = " "; //?????

        • 1. Re: A simple question
          Laubender Adobe Community Professional & MVP

          @hamdifem – I really recommend using the available DOM documentation when writing a script:

          Indesign JavaScript Help

           

          The chm files you can download from there are searchable.

          So, if you look up insertionPoint from this, you can see, that removing an insertionPoint is done by the method remove(). A method is nothing but a predefined function. It can take none, one or more arguments inside the ().

           

          In case of remove() you simply cannot exchange one object class (the InsertionPoint) for another object class (your String). So you have to assign new contents to that insertionPoint.

           

          If you want to remove a character use the Character class and do a remove() on that character.

           

          Or, and I always wondered why the InsertionPoint class has a remove() method, you can remove one or more characters by a range of insertionPoints (now remove() makes sense for the InsertionPoint class!):

           

          app.selection[0].texts[0].insertionPoints.itemByRange(0,1).remove();
          

           

          Since I do not know, what you have selected (a single insertion point?, one or more characters?) I cannot tell more.

          Btw. What do you mean by "add a point"?

           

          Uwe

          • 2. Re: A simple question
            hamdifem Level 1

            without selecting a character (The point where) next space I want to delete