4 Replies Latest reply on Nov 21, 2016 1:25 AM by moluapple

    force redraw() script

    levi23 Level 1

      Hello such.

      You see, I'm doing a script to select a random TextRange in a textframe.

       

      The script works properly (or so it seems) but when the script ends and the TextRange is selected, if I press the delete key (only disappears selection but not selected text)

       

      I tried to use redraw () and app.redraw () at the end of the script but does not seem to do anything.

       

      is a bug??

       

      You know how could I fix it? Thank you very much in advance.

       

      A greeting.

        • 1. Re: force redraw() script
          o-marat Level 3

          And if you press the delete key again, then all text frame will be deleted.

          Behavior of the TextRange.textSelection so strange. It is not like a manually text range selection.

          If it was selected via script, then you can do something with the selected text via script (e.g. delete symbols), but not manually.

          • 2. Re: force redraw() script
            pixxxel schubser Level 5

            levi23 schrieb:

             

            Hello such.

            You see, I'm doing a script to select a random TextRange in a textframe …

             

            Yes I see --> NOTHING

            Please show us the code you already have.

            • 3. Re: force redraw() script
              levi23 Level 1

              Of course

               

              var myDoc = app.activeDocument;
              var sel = myDoc.selection[0];
              
              
              for (a = 0; a < sel.words.length; a++) {
                  var W = sel.words[a];
                  W.select(true)
              }
              
              
              redraw()
              

               

               

              I would like the selected text resulting, could be useful for working manually from the program (remove be very useful depending on the code)

               

              Any help please?

               

              Thank you very much

              • 4. Re: force redraw() script
                moluapple Level 4

                o-marat 撰写:

                Behavior of the TextRange.textSelection so strange. It is not like a manually text range selection.

                Of course is not like selecting text from the UI using Text tool, from UI we can not select individual words without the blank space also been selected.

                So that's just how it works, no fix exists.