apple123 Posted July 19, 2009 Share Posted July 19, 2009 I need help in creating a script that would capture text and manipulate it. For example. Is there a way to capture text from another program and change it. Let's say the user inputed 2345, but he forgot to put a 1. So the script would fix it by putting the 1 and then refocus the cursor to the end of the text. The script also has to be ready to change the text, because the user can change the text anytime, so the script would have to monitor or any changes. Does does script has to loop everytime to check i the user inputed something? Link to comment Share on other sites More sharing options...
MDCT Posted July 19, 2009 Share Posted July 19, 2009 (edited) I need help in creating a script that would capture text and manipulate it. For example. Is there a way to capture text from another program and change it. Let's say the user inputed 2345, but he forgot to put a 1. So the script would fix it by putting the 1 and then refocus the cursor to the end of the text. The script also has to be ready to change the text, because the user can change the text anytime, so the script would have to monitor or any changes. Does does script has to loop everytime to check i the user inputed something? My first suggestion is to read on WinGetText. http://www.autoitscript.com/autoit3/docs/functions/WinGetText.htm Second, for the loop you can try this: Run("notepad.exe") While not WinExists("Untitled -") Sleep(50) WEnd While WinExists("Untitled -") Sleep(50) $text = WinGetText("Untitled -", "") Consolewrite($text) Wend It will open a new notepad and it will get the text you input to the notepad. Good luck. EDIT: Oops, I just realized you want to get text from a control, right? Instead WinGetText, use ControlGetText. http://www.autoitscript.com/autoit3/docs/functions/ControlGetText.htm Edited July 19, 2009 by MDCT 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