PDA

View Full Version : AutoIt Help With Bot



Moxxy
04-12-2009, 11:08
Hey guys

I would like someone to write me a tut on how to create a bot that can autopost to forums.. And how to customize these bots to change what its posting, etc.. Hopefully one of you AutoIt guru's can help me out;)

AlmarM
04-12-2009, 13:36
Well, its not that hard. The main functions you want to use are:


MouseClick
Send


Heres a quick how to:

Step 1. Find out what you need to do (Click somewhere, send some text, click somewhere else, etc.)
Step 2. Get the coordinates, I just released a handy tool for that here (http://www.fleud.com/release-get-mouse-t747.html).
Step 3. Start scripting your bot. For example you need to login somewhere.
You already found out (by doing step 1 and 2) where and what u need to do.
Example:
Click at pos X: 100 Y:200 and send "username"
Click at pos X: 150 Y:200 and send "password"
Click at pos X: 150 Y:250 (Login Button)

That would be:

MouseClick("left", 100, 200, 1, 0) ; look at MouseClick in the helpfile for parameters
Send("username")
Sleep(1000) ; A little delay
MouseClick("left", 150, 200, 1, 0)
Send("password")
Sleep(1000)
MouseClick("left", 150, 250, 1, 0)

It isnt that hard at all. If you want the script to loop itself until you exit the script, add a While 1 at the top and a WEnd at the bottom.

:rolleyes:

Moxxy
04-12-2009, 15:03
Thanks man :) when you say 'loop' itself, do you mean carry on repeating the steps until i exit the script?

And how do I make it run in the background so I can other stuff while the bot is running.
I am aware of how to use mouse co-ordinates and the basic send function but the reason i originally gave up with AutoIt was because I couldnt make anything run in the background..

Reinn
04-12-2009, 16:06
Thanks man :) when you say 'loop' itself, do you mean carry on repeating the steps until i exit the script?

Yep, that's what loop means :P but I think you would have to have a big sleep, else the site wouldn't be able to load before the bot starts again.


And how do I make it run in the background so I can other stuff while the bot is running.
I am aware of how to use mouse co-ordinates and the basic send function but the reason i originally gave up with AutoIt was because I couldnt make anything run in the background..ControlClick & ControlSend functions.


The following is an example of writing "This string is sent in the backgroun" pushing "ENTER" and then writing "See, it isn't that hard afterall? ;)". Then we'll make it click... All in the background!

ControlSend("Untitled - Notepad", "", "[CLASS:Edit; INSTANCE:1]", "This string is sent in the background")
Sleep(1000)
ControlSend("Untitled - Notepad", "", "[CLASS:Edit; INSTANCE:1]", "{ENTER}")
Sleep(1000)
ControlSend("Untitled - Notepad", "", "[CLASS:Edit; INSTANCE:1]", "See, it isn't that hard afterall? ;)")
Sleep(1000)
ControlClick("Untitled - Notepad", "", "MDIClient1", "Left", 1, 100, 200)Very simple code, and please correct me on the ControlClick if I'm wrong, because I'm not 100% sure about it...

AlmarM
04-12-2009, 21:34
Yush, like Reinn said, ControlSend, ControlClick.


else the site wouldn't be able to load before the bot starts again.
In that case, we could use _IE* functions, but thats a more hard way, stay with the way we explained now. ^^,

:rolleyes:

Moxxy
06-12-2009, 18:12
Can someone help me with the ControlClick function and the ControlSend fuction?
When to use :
"[CLASS:Edit; INSTANCE:1]"
"MDIClient1"
etc..

Thanks

Reinn
24-01-2010, 00:38
I would suggest you checking out my AutoIt Help Script (http://www.fleud.com/showthread.php?818-AutoIt-Help-script), I think you could learn a lot from that one.

And as to the "[CLASS:Edit; INSTANCE:1]", it all depends on what you need. Those are going to be different, because you'll probably need different things. It's hard to explain, but when I don't know what to input, I just read the help file (e.g. "Controlsend") and then check out what they write, the remarks, and eventually the "test" script in the very bottom. That helps me a lot, when I code something.