Copy/Cut Highlighted Text from Input Box - Forum

Forum Navigation
You need to log in to create posts and topics.

Copy/Cut Highlighted Text from Input Box

I'm familiar with the Clipboard variable, however I'm not sure how to do this or if it's possible.

I have a multi-line text input box. If I highlight just part of the text in that object, is there a way to determine what text is highlighted, then cut or copy it to the clipboard via code?

It would just be a time-saving convenience. I'm pasting a question with multiple answers into that field, then cutting out each answer to go into separate choice fields. I already have paste buttons to paste from the clipboard into each of those fields.

So, actually, the only thing I need to know is whether there's a way to detect highlighted text in an input box, I guess.

I don't know of a way to do this with a text input box. Something like this can be accomplished with the Editors Toolbox plugin though. You can use the teSetText and teGetText commands. I dont know all the details of your project but this could possibly work.

vwatson has reacted to this post.
vwatson

Okay, thanks. Not a huge deal. The program is just an intermediary step in the process of creating a multimedia course. I'm entering the questions and organizing them by level and category in this NeoWin program before importing them into another system.

@vwatson

I have a multi-line text input box. If I highlight just part of the text in that object, is there a way to determine what text is highlighted, then cut or copy it to the clipboard via code?

I am unsure if you want to detect what was hilited (e.g. by way of having a variable populated with the hilited text) ...

- automatically, every time you complete "the hilite of some text within the TextEntryBox"

or

- when you click on a Button object

If it is the latter, this script associated with a Button object ...

... what is hilited in MultiLineText1 object
FocusObject "YourMultiLineTextHere"
SendKeys "" "{CtrlDn}C{CtrlUp}"
AlertBox "Highlited Text" "[Clipboard]"

... will do the job.

luishp, mazzu001 and vwatson have reacted to this post.
luishpmazzu001vwatson

Worked like a charm. :)