3 Replies Latest reply on Dec 23, 2014 12:22 PM by SteveFransen_1

    selected text

    djmonad

      Title

      selected text

      Post

           can i access selected text (highlighted but not copied) in a script

           i want to select text in a field but not the whole field

           then change style with a script

           but i cannot find a way to designate the selected text

        • 1. Re: selected text
          philmodjunk

               There are two get functions that you can use in combination to access the selected text:

               Get ( ActiveSelectionStart )
               Get ( ActiveSelectionSize )

               One way to style the selected text sould be to use:

               Insert Calculated Result [TextStyleAdd ( Middle ( Get ( ActiveFieldContents ) ; Get ( ActiveSelectionStart ) ; Get ( ActiveSelectionSize ) ; //put style expression here ) ]

               This is one of the few cases where I will use an "insert" type script step in place of Set Field. Make sure NOT to select a target field so that the step will act directly on the selected text or cursor position.

                

          • 2. Re: selected text
            djmonad

                 tx

                 that workssmiley

            • 3. Re: selected text
              SteveFransen_1

              Insert Calculated Result [TextStyleAdd ( Middle ( Get ( ActiveFieldContents ) ; Get ( ActiveSelectionStart ) ; Get ( ActiveSelectionSize ) ; //put style expression here ) ]

              Thanks Phil, this is very helpful.

               I want the style to change as soon as the user double clicks, or clicks and drags, to select some text. So, how do I trigger this script as soon as the user selects the text to be formatted?

              Thanks-again,

              Steve