Sign in to follow this  
Followers 0
apple123

Monitor text from another program

2 posts in this topic

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?

Share this post


Link to post
Share on other sites



#2 ·  Posted (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 by MDCT

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