NegativeNrG Posted April 28, 2006 Posted April 28, 2006 (edited) Saw ZeroZShadow post about the IRC examples.Well here's a script that can connect to an IRC channel, chat(using the menu>PRIVATEMSG), Also supports Hotmail that can send e-mails(search google on commands).Script:Code: AutoIt#include <GUIConstants.au3>#Include <GUIEdit.au3>;#INclude <string.au3>#notrayicon; == GUI generated with Koda ==Global $nick = ''$Input = InputBox('Enter name','Enter Your Name')Global $nick = $InputGlobal $nick1 = $InputGlobal $nick2 = $InputGlobal $nick3 = $InputGlobal $nick4 = $InputTCPStartup()Global $mainsocket = -1, $maxchar = 512000$Form1 = GUICreate("Chat BETA 0.1", 237, 229, 340, 437)GUICtrlCreateLabel("Information:", 8, 8, 59, 17)$List1 = GUICtrlCreateList("", 0, 24, 233, 110, -1, $WS_EX_CLIENTEDGE)GUICtrlCreateLabel("IP:", 8, 136, 17, 17)$Input1 = GUICtrlCreateInput("", 24, 136, 193, 21, -1, $WS_EX_CLIENTEDGE)GUICtrlCreateLabel("Port:", 8, 160, 26, 17)$Input2 = GUICtrlCreateInput("", 32, 160, 185, 21, -1, $WS_EX_CLIENTEDGE)$Combo1 = GUICtrlCreateCombo('', 32, 184, 201, 21)GUIctrlsetdata($Combo1,'Hotmail Server')GUICtrlCreateLabel("Server", 0, 184, 35, 17)$Button1 = GUICtrlCreateButton("Connect", 72, 208, 89, 17)GUISetState(@SW_SHOW)GUIctrlsetdata($List1,'Chat Loaded.')GUIctrlsetdata($List1,'Made by NegativeNrG')While 1 $recv = TCPRecv($mainsocket,$maxchar) if $recv <> '' Then GUictrlsetdata($List1,$recv) Elseif $recv = 'Rock' Then TCPSend($mainsocket,'Paper') Endif ; if GUIctrlread($Combo1) = 'hello' Then;GUictrlsetdata($Input1,'asdsdsda');Elseif GUictrlread($Combo1) = 'wtf' Then;GUIctrlsetdata($Input2,'asdasadgfh');EndIf $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop;Case $msg = $Combo1;if GUIctrlread($Combo1) = 'Hotmail' Then;GUIctrlsetdata($Input1,'mail.hotmail.com');GUIctrlsetdata($Input2,'25');EndIf Case $msg = $Button1 If StringInStr(GUictrlread($Input1),'irc') or StringinStr(GUictrlread($Input1),'gamerz') Then GUIctrlsetdata($List1,'') GUIctrlsetdata($List1,GUIctrlread($List1) & 'Contacting Server..') Global $mainsocket = TCPConnect(TCPNameTOIp(GUIctrlread($Input1)),GUIctrlread($Input2)) Global $connectiontype = 'IRC';TCPSend($mainsocket,'NICK ' & $nick & @CRLF);TCPSend($mainsocket,'USER ' & $nick & $nick1 & $nick2 & $nick3 & $nick4 & @CRLF) Elseif StringinStr(GUIctrlread($Input1),'mail') Then Global $mainsocket = TCPCOnnect(TCPNameToIP(GUictrlread($Input1)),GUIctrlread($Input2)) Global $connectiontype = 'mail' Elseif StringInStr(GUIctrlread($Input1),'www') Then Global $mainsocket = TCPConnect(TCPNameToIp(GUIctrlread($Input1)),GUIctrlread($Input2)) Global $connectiontype = 'WWW' Else Global $mainsocket = TCPConnect(GUictrlread($Input1),GUictrlread($Input2)) GLobal $connectiontype = 'Normal' EndIf if $mainsocket = -1 Then GUictrlsetdata($List1,'') GUictrlsetdata($List1, 'Unable to Connect..') Else GUIctrlsetdata($List1,'') GUIctrlsetdata($List1, 'Server = ' & GUIctrlread($Input1) & ':' & GUIctrlread($Input2)) GUIctrlsetdata($List1,'SuccessFully Connected') TCPSend($mainsocket,$nick & ' Connected') Sleep(1000) EndIf ; == GUI generated with Koda ==;TCPStartup();Global $mainsocket = -1, $maxchar = 512000$Form2 = GUICreate("Chat Window", 349, 220, 192, 125)$Edit1 = GUICtrlCreateEdit("", 0, 0, 345, 169, $ES_READONLY, $WS_EX_CLIENTEDGE)GUICtrlSetData($Edit1, "")$Input4 = GUICtrlCreateInput("", 0, 168, 265, 21, -1, $WS_EX_CLIENTEDGE)$Button4 = GUICtrlCreateButton("Send", 264, 168, 81, 17,$BS_DEFPUSHBUTTON)$packetshow = GUIctrlcreatemenu('Verify Username')$packetshowa = GUIctrlcreateMenuItem('Verify Username',$packetshow)$tools = GUIctrlcreatemenu('Tools')$priv = GUictrlcreateMenuitem('Private Message',$tools)GUISetState(@SW_SHOW);$mainsocket = TCPConnect(GUictrlread($Input1),GUIctrlread($Input2))While 1 $recv = TCPRecv($mainsocket,$maxchar) if $recv <> '' Then GUictrlsetdata($Edit1,GUIctrlread($Edit1) & @CRLF & $recv) _GUIctrlEditLineScroll($Edit1,0,_GUIctrlEDITGetLineCount($Edit1)) EndIf If Not WinActive('Chat Window') And $recv <> '' Then SoundPlay('type.wav') EndIf If StringinStr($recv,'PING') Then TCPSend($mainsocket,'PONG ' & StringSplit($recv," ")) EndIf $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $packetshowa TCPSend($mainsocket,'NICK' & ' ' & $nick & @CRLF) TCPSend($mainsocket,'USER' & ' ' &$nick & ' ' & $nick1 & ' ' & $nick2 & ' ' & $nick3 & ' ' & $nick4 & @CRLF) Case $msg = $priv $msguser = Inputbox('Message','Private Message to who?') $messagetosend = Inputbox('Message','Enter Your Message') TCPSend($mainsocket,'PRIVMSG ' & $msguser & ' :' & $messagetosend & @CRLF) Case $msg = $Button4 if $connectiontype = 'IRC' or 'mail' Then TCPSend($mainsocket,GUIctrlread($Input4) & @CRLF);$nick & ': ' & GUictrlread($Input4)) GUIctrlsetdata($Edit1,GUIctrlread($Edit1) & @CRLF & GUIctrlread($Input4)) GUIctrlsetdata($Input4,'') _GUIctrlEditLineScroll($Edit1,0,_GUIctrlEDITGetLineCount($Edit1)) Elseif $connectiontype = 'Normal' Then TCPSend($mainsocket,$nick & ': ' & GUictrlread($Input4)) GUIctrlsetdata($Edit1,GUIctrlread($Edit1) & @CRLF & $nick & ': ' & GUIctrlread($Input4)) GUIctrlsetdata($Input4,'') _GUIctrlEditLineScroll($Edit1,0,_GUIctrlEDITGetLineCount($Edit1)) if StringLeft(GUictrlread($Input4),5) = '/nick' Then Changenick() Elseif StringLeft(GUIctrlread($Input4),3) = '/me' Then me() Elseif StringLeft(GUIctrlread($Input4),5) = '/Send' Then TCPSendFile();Elseif stringLeft(GUIctrlread($Input4),5) = '/kill' Then;Kill(); ElseIf StringLeft(GUIctrlread($Input4),9) = '/Adminlog' Then ; password() Endif Endif;TCPSend($mainsocket,GUIctrlread($Input4) & @CRLF);$nick & ': ' & GUictrlread($Input4));GUIctrlsetdata($Edit1,GUIctrlread($Edit1) & @CRLF & $nick & ': ' & GUIctrlread($Input4));GUIctrlsetdata($Input4,'');_GUIctrlEditLineScroll($Edit1,0,_GUIctrlEDITGetLineCount($Edit1)) Case Else;;;;;;; EndSelectWEndGUIDelete($Form2) Case Else;;;;;;; EndSelectWEnd Func Changenick() Local $nickchange = StringTrimLeft(StringStripWS(GUIctrlread($Input4),2),6) TCPSend($mainsocket,$nick & ' is now known as ' & $nickchange & @CRLF) Global $nick = $nickchange GUIctrlsetdata($Edit1,GUIctrlread($Edit1) & @CRLF & $nick & ': ' & GUIctrlread($Input4))EndFuncFunc me() Local $message = StringTrimLeft(StringStripWS(GUIctrlread($Input4),2),4) TCPSend($mainsocket,'*' & $nick & ' ' & $message & @CRLF) GUIctrlsetdata($Edit1,GUICtrlread($Edit1) & @CRLF & '*' & $nick & ' ' & $message & @CRLF)EndFuncFunc TCPSendFile() Local $File = StringTrimLeft(StringStripWS(GUIctrlread($Input4),2),6) Local $data = FileRead($File,FileGetSize($File)) TCPSend($mainsocket,FileGetSize($File) & ',' & $data)EndFuncFunc _HexToString($strHex) Local $strChar, $aryHex, $i, $iDec, $Char, $file, $strHexa, $iOne, $iTwo $aryHex = StringSplit( Edited May 18, 2006 by NegativeNrG [size=20]My File Upload[/size]Register at my site and upload.
zeroZshadow Posted April 28, 2006 Posted April 28, 2006 mm u forgot some stuff, i get errors here. the Password() function doesn't work. *If u thought life couldn't get worse, u meet me *<guy> What would you give my little sister to unzip ?<friend> 10 bucks<guy> No, i mean like Winzip...
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