Sign in to follow this  
Followers 0
Suzuran

Get string and send

7 posts in this topic

Hi. I'm new to AutoIt and I have one question. How do I get a text from a chat window to analyze it and then send back another text?

Share this post


Link to post
Share on other sites



Try with Auto It Info Window from your start menu. With this tool you can identify the control which contains the text.

Then with ControlGetText() you can read it and process.

Regards,

Buffo

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

You want to look at the help under at the Control functions (and/or possibly WinGetText) and the Autoit window info. 'Analyzing' the text depends on what you mean.... but you'll want to check out StringInStr. For sending the text use ControlSend.

Hope this helps

EDIT: beat to it by Buffo

Edited by someone

While ProcessExists('Andrews bad day.exe')
	BlockInput(1)
	SoundPlay('Music.wav')
	SoundSetWaveVolume('Louder')
WEnd

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

I want to make a script which sends an away message when someone starts a conversation with me on messenger.

Edited by Suzuran

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

I did this:

ControlGetText("", "", "109824256")
Sleep(1000)
Send("I'm currently away from the computer{ENTER}")
Sleep(1000)

But it runs only one time and it types the text in the active window, even if nobody started a conversation

Edited by Suzuran

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

You have to think about what the script you wrote is doing...

It runs once because you didn't put it in a loop, it sends to the active window because of how Send works(it sends the text to the active window). Try opening two test windows, and using your text in a while/wend loop and using controlsend as opposed to Send.

Something like this

While 1 ; Keeps the script going
ControlGetText("", "", "109824256")
Sleep(1000)
ControlSend("title of 2nd window", "", controlID, "I'm away text");note it doesn't Send ENTER
Sleep(1000)
Sleep(15000) ; Will loop the script every 15 seconds
Wend ; End of Loop statement

I didn't test that code(as I'm eating) but hopefully that gives you a better idea. There are several kinds of loops in autoit but in this case While 1 keeps the script running until you stop it, hence why I added the larger sleep at the end; so the script doesn't overload you with sending text but will do it every 15 seconds. If you get stuck post your code we'll try to help.

EDIT: fixed some spelling, made myself clearer(hopefully)

Edited by someone

While ProcessExists('Andrews bad day.exe')
	BlockInput(1)
	SoundPlay('Music.wav')
	SoundSetWaveVolume('Louder')
WEnd

Share this post


Link to post
Share on other sites

Thanks for the help. I'll search some good tutorials on Google and learn things.

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