Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Format Text
#1
Hi,

Is there any way to format text that's in the clipboard?

For example, say I copied the text 'xxxyyyzzz' would it be possible change it or paste it as just 'yyy' (cutting out portions of the original text)?

Thanks for any help.
#2
Code:
Copy      Help
str s
;get clipboard text
s.getclip ;;or s.getsel to copy selection

;as an example, convert it to uppercase and replace spaces to commas
s.ucase
s.findreplace(" " ",")

;Similarly you can perform other operations on the string that is stored
;in variable s. There are no dialogs to insert string manipulation functions.
;You will find the list of available functions in QM Help, Reference (just
;click the Help button on the toolbar).


;place it to the clipboard
s.setclip ;;or s.setsel to paste directly

;This works well with simple text, but if you are working with rich
;text, the formatting (colors, styles, etc) probably will be lost.
#3
Thanks Gintaras, it works very well.

Gintaras Wrote:
Code:
Copy      Help
str s
;get clipboard text
s.getclip ;;or s.getsel to copy selection

;as an example, convert it to uppercase and replace spaces to commas
s.ucase
s.findreplace(" " ",")

;Similarly you can perform other operations on the string that is stored
;in variable s. There are no dialogs to insert string manipulation functions.
;You will find the list of available functions in QM Help, Reference (just
;click the Help button on the toolbar).


;place it to the clipboard
s.setclip ;;or s.setsel to paste directly

;This works well with simple text, but if you are working with rich
;text, the formatting (colors, styles, etc) probably will be lost.


Forum Jump:


Users browsing this thread: 1 Guest(s)