Jump to content

Get string and send


Suzuran
 Share

Recommended Posts

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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...