5 Replies Latest reply on Oct 2, 2011 10:55 AM by DarrellKitchen

    Select Field Content from Current Cursor Position

    DarrellKitchen

      Title

      Select Field Content from Current Cursor Position

      Post

      I need assistance on trying to figure out how to select text from my current cursor position (or current insert point) in the field to the end of field.  Not from the beginning of the field, or from the end of the field, but from where I position the insert point by clicking at an arbitrary position within the field.  Does this make sense?

      Example: Now is the time for all good men to come to the aid of their country.

      If I position the insert point at "men" and want to select everything from there to the period ".", what is the formula for doing this?

      In advance, I thank you for any assistance rendered.

       

       

        • 1. Re: Select Field Content from Current Cursor Position
          DarrellKitchen

          I just figured it out, so Ill post a response to my own question in case anyone else needs this solution:

          Set Selection [Start Position: Get ( ActiveSelectionStart ); End Position: Length ( text ) ]

          • 2. Re: Select Field Content from Current Cursor Position
            Sorbsbuster

            And works neatly if you set that to be a script trigger on entry.

            • 3. Re: Select Field Content from Current Cursor Position
              DarrellKitchen

              Thanks for that idea, Sorbsbuster.

              Initially, this was for a massive amount of data that I post into a field that gets parsed out into several fields and requires visual monitoring and manual interaction.

              Set Selection [Start Position: Get ( ActiveSelectionStart ); End Position: Length ( ${database}::field )]
              Cut []
              New Record/Request
              Paste [Select]
              Set Selection [Start Position: 1; End Position: Length ( LeftWords ( ${database}::field; 1 ))]
              Cut []
              Paste [Select; database::field]
              Set Selection [database::field; Start Position: 1; End Position: 2]
              Cut []

              If there was a way to send a backspace key, I would use that instead of the redundant Cut [] forumlas near the end of the script.

              • 4. Re: Select Field Content from Current Cursor Position
                Sorbsbuster

                I'm not quite clear what your script does.  Looks like:

                - Pick up all the text from your click-point to the end of the field and cut it
                - create a new record and paste the cut data into the same field
                - pick up the first word that was pasted, and cut it
                - replace the data that was in the field in the new record with that starting word
                - pick up the first character in the field and cut it

                Maybe I've missed the point, but is that not just the same thing as picking up the first word from where you put the insertion point in the first place?  I just wondered why you didn't just pick up that alone.

                Also The Purists would object to you 'mucking' with the users's clipboard!

                • 5. Re: Select Field Content from Current Cursor Position
                  DarrellKitchen

                  Yes, basically, you are correct.  Only {Replace the data in a different field in the new record with that starting word}.  Then I have to scan down to the next occurance.  That is it is a massive amount of data in the form of a book, chapter, paragraph-title, and paragraph. 

                  I [manually] paste the mass of text in the paragraph field,
                  scan down to the paragraph-title, click in at the title beginning,
                  press Alt-1 to run the script which,
                  cuts the remaining data from the insertion point to end of field,
                  creates a new record,
                  pastes the data in the [new] paragraph field,
                  cut out the paragraph-title,
                  paste it into the paragraph-title field,
                  select the remaining two paragraph marks (0x0D, 0x0A X 2) at left over after removing the title,
                  and cut them out (which is why I would rather use a backspace key, or delete key but dont know how to send them to the script as an event on a PC).

                  I also have another script which is very similar to the above, only it acts on the chapter field when I run into a change in chapter (Alt-2 script).

                  This script may seem rather non-functional as a database script, but like I mentioned in the previous post, its for parsing the data to set up the database records.  Doing all this by hand, via click, press CTRL-SHIFT-END, CTRL-X, CTRL-N, CTRL-V, CTRL-HOME, SHIFT-END, CTRL-X, (paste in paragraph-title field), Del-Del-Del, {rince and repeat}, will take forever.  BTW: tab order has been chnged where the paragraph has focus on creating a new record, hence the jump from ctrl-n to ctrl-v.