DoubleMcLovin Posted April 14, 2010 Posted April 14, 2010 I am trying to make a bot that will wait for a regex statement in mIRC and reply accordingly. I have some of the basic mechanics set up, and I think I can probably even get it to post. I only have 2 problems: 1) Determining the ID# of the text field automatically (so that I can send through the right area) 2) ControlGetText even on the proper ID of the window cannot retrieve correct text, it always gets my active windows rather than the text in the window no matter which area I select.
BrettF Posted April 14, 2010 Posted April 14, 2010 FYI spam bots and the like a frowned upon. Unless you want to explain your full intentions... Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version!
AoRaToS Posted April 14, 2010 Posted April 14, 2010 Why don't you use the mIRC scripting language for that? You can use that for finding the text, then export it somewhere (create a window with the text or a file), use the text with AutoIt, and whatever reply you have, save it back to the file and have mIRC take it and use it... Using only AutoIt to control mIRC won't be that easy and using mIRC for the bot won't be that powerful, conbine them in some way and you might make it work.... s!mpL3 LAN Messenger Current version 2.9.9.1 [04/07/2019] s!mpL3 LAN Messenger.zip s!mpL3
DoubleMcLovin Posted April 14, 2010 Author Posted April 14, 2010 (edited) FYI spam bots and the like a frowned upon. Unless you want to explain your full intentions...Def. Not a spam bot. I want the bot to be capable of interpreting text, such as when someone says "How do I register my nick?" The bot will pick up on a regex statement something like (?i)How.*register.*nick (my regex is a little rusty). and will reply with a pm telling the individual how to register their nick. I had one I had worked out in perl using some ideas from other scripts that I played around with until it worked, but my HDD died on me so I lost that, and I would like to code one from scratch now. If I just wanted the spambot it wouldn't be too difficult to use autoit to just send keystrokes. I want to be able to interpret text in the channel which should stand to prove I do not plan on being a spammer with this.I will look into a way to use the mIRC language along with this, I'd image I can create a file that flushes after 100kb or something, but with the large quantities of text flowing through some channels that might prove rather inefficient a method. Surely there is a way to get autoit to read directly from the window? Edited April 14, 2010 by DoubleMcLovin
BrettF Posted April 14, 2010 Posted April 14, 2010 You won't be the first to want to automate mIRC, so maybe have a search for it...? Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version!
DoubleMcLovin Posted April 15, 2010 Author Posted April 15, 2010 I have, the best I could find were 2 scripts in C++ and Perl. No one had any insight for using autoIt
JRowe Posted April 15, 2010 Posted April 15, 2010 Best option, use the AutoIt IRC library instead of botting through automation. It's perfectly functional. Note: This is not my code, I just updated it to fix the PONG, the code is in the examples forum. expandcollapse popup;=============================================================================== ; ; Description: Connects you to a IRC Server, and gives your chosen Nick ; Parameter(s): $server - IRC Server you wish to connect to ; $port - Port to connect to (Usually 6667) ; $nick - Nick you choose to use (You can change later) ; Requirement(s): TCPStartup () to be run ; Return Value(s): On Success - Socket identifer ; On Failure - It will exit on error ; Author(s): Chip ; Note(s): English only ; ;=============================================================================== Func _IRCConnect ($server, $port, $nick) Local $i = TCPConnect(TCPNameToIP($server), $port) If $i = -1 Then Exit MsgBox(1, "IRC.au3 Error", "Server " & $server & " is not responding.") TCPSend($i, "NICK " & $nick & @CRLF) TCPSend($i, "USER " & $nick & " 0 0 " & $nick &@CRLF) Return $i EndFunc ;=============================================================================== ; ; Description: Joins an IRC Channel ; Parameter(s): $irc - Socket Identifer from _IRCConnect () ; $chan - Channel you wish to join ; Requirement(s): _IRCConnect () to be run ; Return Value(s): On Success - 1 ; On Failure - -1 = Server disconnected. ; Author(s): Chip ; Note(s): English only ; ;=============================================================================== Func _IRCJoinChannel ($irc, $chan) If $irc = -1 Then Return 0 TCPSend($irc, "JOIN " & $chan & @CRLF) If @error Then MsgBox(1, "IRC.au3", "Server has disconnected. 1") Return -1 EndIf Return 1 EndFunc ;=============================================================================== ; ; Description: Sends a message using IRC ; Parameter(s): $irc - Socket Identifer from _IRCConnect () ; $msg - Message you want to send ; $chan - Channel/Nick you wish to send to ; Requirement(s): _IRCConnect () to be run ; Return Value(s): On Success - 1 ; On Failure - -1 = Server disconnected. ; Author(s): Chip ; Note(s): English only ; ;=============================================================================== Func _IRCSendMessage ($irc, $msg, $chan="") If $irc = -1 Then Return 0 If $chan = "" Then TCPSend($irc, $msg & @CRLF) If @error Then MsgBox(1, "IRC.au3", "Server has disconnected. 3") Return -1 EndIf Return 1 EndIf TCPSend($irc, "PRIVMSG " & $chan & " :" & $msg & @CRLF) If @error Then MsgBox(1, "IRC.au3", "Server has disconnected. 4") Return -1 EndIf Return 1 EndFunc ;=============================================================================== ; ; Description: Changes a MODE on IRC ; Parameter(s): $irc - Socket Identifer from _IRCConnect () ; $mode - Mode you wish to change ; $chan - Channel/Nick you wish to send to ; Requirement(s): _IRCConnect () to be run ; Return Value(s): On Success - 1 ; On Failure - -1 = Server disconnected. ; Author(s): Chip ; Note(s): English only ; ;=============================================================================== Func _IRCChangeMode ($irc, $mode, $chan="") If $irc = -1 Then Return 0 If $chan = "" Then TCPSend($irc, "MODE " & $mode & @CRLF) If @error Then MsgBox(1, "IRC.au3", "Server has disconnected. 5") Return -1 EndIf Return 1 EndIf TCPSend($irc, "MODE " & $chan & " " & $mode & @CRLF) If @error Then MsgBox(1, "IRC.au3", "Server has disconnected. 6") Return -1 EndIf Return 1 EndFunc ;=============================================================================== ; ; Description: Returns a PING to Server ; Parameter(s): $irc - Socket Identifer from _IRCConnect () ; $ret - The end of the PING to return ; Requirement(s): _IRCConnect () to be run ; Return Value(s): On Success - 1 ; On Failure - -1 = Server disconnected. ; Author(s): Chip ; Note(s): English only ; ;=============================================================================== Func _IRCPing($irc, $ret) If $ret = "" Then Return -1 TCPSend($irc, "PONG " & $ret & @CRLF) If @error Then MsgBox(1, "IRC.au3", "Server has disconnected. 2") Return -1 EndIf ConsoleWrite("PONG" & $ret & @CRLF) Return 1 EndFunc You can use that to connect and interact with IRC networks. [center]However, like ninjas, cyber warriors operate in silence.AutoIt Chat Engine (+Chatbot) , Link Grammar for AutoIt , Simple Speech RecognitionArtificial Neural Networks UDF , Bayesian Networks UDF , Pattern Matching UDFTransparent PNG GUI Elements , Au3Irrlicht 2Advanced Mouse Events MonitorGrammar Database GeneratorTransitions & Tweening UDFPoker Hand Evaluator[/center]
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