maxilla Posted March 5, 2007 Share Posted March 5, 2007 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 More sharing options...
Shevilie Posted March 5, 2007 Share Posted March 5, 2007 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 Link to comment Share on other sites More sharing options...
maxilla Posted March 5, 2007 Author Share Posted March 5, 2007 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 More sharing options...
Moderators SmOke_N Posted March 5, 2007 Moderators Share Posted March 5, 2007 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 More sharing options...
maxilla Posted March 5, 2007 Author Share Posted March 5, 2007 (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 March 5, 2007 by maxilla Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 5, 2007 Moderators Share Posted March 5, 2007 No,Im losing information like Font,Font Size,Bold and alignment which is vital...Anyway your script made it much betterThis 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 More sharing options...
maxilla Posted March 5, 2007 Author Share Posted March 5, 2007 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 More sharing options...
Moderators SmOke_N Posted March 5, 2007 Moderators Share Posted March 5, 2007 (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 March 5, 2007 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 More sharing options...
maxilla Posted March 5, 2007 Author Share Posted March 5, 2007 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 More sharing options...
Moderators SmOke_N Posted March 5, 2007 Moderators Share Posted March 5, 2007 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 proneWhat 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 More sharing options...
maxilla Posted March 5, 2007 Author Share Posted March 5, 2007 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 More sharing options...
Moderators SmOke_N Posted March 5, 2007 Moderators Share Posted March 5, 2007 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 applicationDo 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 More sharing options...
maxilla Posted March 5, 2007 Author Share Posted March 5, 2007 (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 March 5, 2007 by maxilla Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 5, 2007 Moderators Share Posted March 5, 2007 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 More sharing options...
maxilla Posted March 5, 2007 Author Share Posted March 5, 2007 Ok, well good luck then...Any other information like controlsclasses etc with will be useful to you?Also any RichTextGetTExt(ContrlHandle) Available??? Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 5, 2007 Moderators Share Posted March 5, 2007 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now