Sign in to follow this  
Followers 0
maxilla

Losing formatting ControlGetText

16 posts in this topic

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...

Share this post


Link to post
Share on other sites



Can you get the text manually without autoit ??


Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit

Share this post


Link to post
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?

Share this post


Link to post
Share on other sites

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)

[center]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.[/center]

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

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.

[center]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.[/center]

Share this post


Link to post
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??

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

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

[center]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.[/center]

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

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.

[center]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.[/center]

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

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?

[center]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.[/center]

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

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...

[center]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.[/center]

Share this post


Link to post
Share on other sites

Ok, well good luck then...

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

Share this post


Link to post
Share on other sites

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.

[center]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.[/center]

Share this post


Link to post
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
Sign in to follow this  
Followers 0