Jump to content

Losing formatting ControlGetText


Recommended Posts

I Am trying to copy some text from a windows application to a word document...Since

ctrl+c was not working i used ControlGetText function as

;Title of the application window
WinActivate("WELCOME")
WinWaitActive("WELCOME")

$var=ControlGetText("WELCOME","","RichTextWndClass2")
;RichTextWndClass2 ControlClass i found through AutoIt Info tool....

ClipPut($var)

;Title of the word document

WinActivate("Document")
WinWaitActive("Document")
Send('^{v}')

The code is working but Im losing all the formatting...Formatting is very important for me...Please Help...

Link to comment
Share on other sites

Can you get the text manually without autoit ??

Yah manually i can copy paste using the mouse...though i have to click and drag the whole document...then when i paste in word,its well formatted....simulating click and drag is clumsy as u can easily lose focus...

Also i can See several other classes also in the document area using Auto Info Tool other than richtextclass...some tab class n all...i think they are used for formatting...how can i capture that information also if possible?

Link to comment
Share on other sites

  • Moderators

I Am trying to copy some text from a windows application to a word document...Since

ctrl+c was not working i used ControlGetText function as

The code is working but Im losing all the formatting...Formatting is very important for me...Please Help...

When you say it's losing all formatting, do you mean that it doesn't have the carriage return line feeds? If it looks like just one line... try this.

$var = StringReplace(ControlGetText("WELCOME","","RichTextWndClass2"), @LF, @CRLF)

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

When you say it's losing all formatting, do you mean that it doesn't have the carriage return line feeds? If it looks like just one line... try this.

$var = StringReplace(ControlGetText("WELCOME","","RichTextWndClass2"), @LF, @CRLF)
No,Im losing information like Font,Font Size,Bold and alignment which is vital...

Anyway your script made it much better

Edited by maxilla
Link to comment
Share on other sites

  • Moderators

No,Im losing information like Font,Font Size,Bold and alignment which is vital...

Anyway your script made it much better

This going to happen as far as the loss of the "extras"... The control functions are not set up for Rich Text Edit features... you may want to search in that direction.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

This going to happen as far as the loss of the "extras"... The control functions are not set up for Rich Text Edit features... you may want to search in that direction.

Is there any such methods for rich text ???Formatting is important for me bcoz the text contains other language also in between english whose font is available in word....So manually it works...but using controlgettext,that language characters will bcome junk ..Also this controltextget is not fucntioning in some documents of the same application ...the class is found to be the same by autoitinfo tool...any ideas??

Link to comment
Share on other sites

  • Moderators

Here's a question, when you manually click on the control in question, if you do Ctrl+a then Ctrl+c, then where ever you are pasting it, you do Ctrl+v ... does that work for you manually?

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Here's a question, when you manually click on the control in question, if you do Ctrl+a then Ctrl+c, then where ever you are pasting it, you do Ctrl+v ... does that work for you manually?

NO, Ctrl+a nor shift nor ^END+SHIFT+ ^HOME Combinations work with this application...only way to copy manually is select the text using mouse and drag the text to the word window..i tried to simulate it,but found it very clumsy and error prone

Link to comment
Share on other sites

  • Moderators

NO, Ctrl+a nor shift nor ^END+SHIFT+ ^HOME Combinations work with this application...only way to copy manually is select the text using mouse and drag the text to the word window..i tried to simulate it,but found it very clumsy and error prone

What is the app name you are playing with, maybe I can figure something out.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

What is the app name you are playing with, maybe I can figure something out.

Its a windows application containing historical events arranged as a tree with search fucntions anj all...No idea who made it....Seems like a VB/.net application

Link to comment
Share on other sites

  • Moderators

Its a windows application containing historical events arranged as a tree with search fucntions anj all...No idea who made it....Seems like a VB/.net application

Do you have a link or the app?

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Do you have a link or the app?

No,Sorry....I installed from a cd long back...its like a historical enclypedia...i dont even have the cd with me...

Any other information like controlsclasses etc with will be useful to you?Also any RichTextGetTExt(ContrlHandle) Available???

Edited by maxilla
Link to comment
Share on other sites

  • Moderators

No,Sorry....I installed from a cd long back...its like a historical enclypedia...i dont even have the cd with me...

Ok, well good luck then...

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

  • Moderators

Any other information like controlsclasses etc with will be useful to you?Also any RichTextGetTExt(ContrlHandle) Available???

Not to for me, maybe someone else with more patience than I. I'm not much for chasing my tail.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...