Dale2507 Posted June 15, 2007 Share Posted June 15, 2007 (edited) I've picked up on this chat program in the example scripts but it could only accept 1 connection. I thought UDP might support multiple connections so i had a go but now it won't send messages. Any thoughts? CODE #include <GUIConstants.au3> #include <File.au3> #include <Misc.au3> #Include <GuiList.au3> Dim $ConnectedSocket = -1 Global $CSock[1] Dim $MainSocket $CSock[0] = 0 ;;;client $socket = -1 $nick = FileReadLine(@ScriptDir & "/settings.ini", 1) If FileExists(@ScriptDir & "/settings.ini") Then Sleep(10) Else _FileCreate(@ScriptDir & "/settings.ini") EndIf If FileReadLine(@ScriptDir & "/settings.ini", 1) = "" Then $nick = InputBox("K Chat Program", "Enter a nickname to use when chatting") While 1 If $nick = "" Then $nick = InputBox("K Chat Program", "Please enter a nickname") Else _FileWriteToLine(@ScriptDir & "/settings.ini", 1, $nick, 1) ExitLoop EndIf WEnd ;;;;;;;;;;;;;;;;;;;; If FileReadLine(@ScriptDir & "/settings.ini", 2) = "" Then _FileWriteToLine(@ScriptDir & "/settings.ini", 2, "000000", 1) _FileWriteToLine(@ScriptDir & "/settings.ini", 3, "Arial", 1) _FileWriteToLine(@ScriptDir & "/settings.ini", 4, "9", 1) _FileWriteToLine(@ScriptDir & "/settings.ini", 5, "400", 1) _FileWriteToLine(@ScriptDir & "/settings.ini", 6, "1", 1) EndIf $f = FileReadLine(@ScriptDir & "/settings.ini", 2) $n = FileReadLine(@ScriptDir & "/settings.ini", 3) $s = FileReadLine(@ScriptDir & "/settings.ini", 4) $w = FileReadLine(@ScriptDir & "/settings.ini", 5) $a = FileReadLine(@ScriptDir & "/settings.ini", 6) ;;;;;;;;;;;;;;;;; $port = "3333" $ipaddress = InputBox("IpAdress", "Enter the ip to connect to, leave blank if you are the server!") If $ipaddress = "" Then $ipaddress = @IPAddress1 $MainSocket = _UDPCreateMainListeningSocket($ipaddress, $port) If @error Or $MainSocket = -1 Then Exit EndIf UDPStartup() ;gui $gui = GUICreate($nick & "'s Chat", 580, 250) $menu = GUICtrlCreateMenu("Program") $set = GUICtrlCreateMenuItem("Settings", $menu) $menu1 = GUICtrlCreateMenuItem("Exit", $menu) $menu3 = GUICtrlCreateMenu("Help") $menu4 = GUICtrlCreateMenuItem("About", $menu3) $userlist = GUICtrlCreateLabel("UserList:", 485, 5) $bsend = GUICtrlCreateButton("Send", 380, 145, 60, 80) $list = GUICtrlCreateList($nick, 445, 22, 125, 213) $edit = GUICtrlCreateEdit("", 5, 5, 435, 130, BitOR($ES_AUTOVSCROLL, $WS_VSCROLL, $ES_READONLY)) GUICtrlSetFont(-1, $s, $w, $a, $n) GUICtrlSetColor(-1, $f) GUICtrlSetBkColor(-1, 0xffffff) $input = GUICtrlCreateEdit("", 5, 145, 375, 80, BitOR($WS_VSCROLL, $ES_AUTOVSCROLL, $ES_MULTILINE)) GUICtrlSetFont($input, $s, $w, $a, $n) GUICtrlSetColor($input, $f) GUISetState() GUICtrlSetState($input, $GUI_FOCUS) $socket = UDPOpen($ipaddress, $port) If $socket < 0 Then MsgBox(0, "Error", "Could not connect to server") Exit Else UDPSend($socket, "Server: " & $nick & " is connected.") EndIf ;;;;;;;; While 1 $nick = FileReadLine(@ScriptDir & "/settings.ini", 1) $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then Exit If $msg = $menu1 Then Exit If $msg = $menu4 Then MsgBox(0, "About", "Simple Chat Program. Coding by Kreatorul, 2007. Contact: bal_dabac@yahoo.com") If $msg = $set Then $gui2 = GUICreate("Settings", 200, 100) $label = GUICtrlCreateLabel("Nickname:", 5, 8) $ninput = GUICtrlCreateInput("", 65, 5, 130) $label1 = GUICtrlCreateLabel("Chat Font:", 5, 41) $color = GUICtrlCreateButton("Select", 65, 35, 130) $sett = GUICtrlCreateButton("Ok", 65, 70, 70) GUISetState() While 1 $msgg = GUIGetMsg() If $msgg = $GUI_EVENT_CLOSE Then GUIDelete($gui2) ExitLoop EndIf If $msgg = $color Then $font = _ChooseFont() If (@error) Then GUICtrlSetColor($edit, $f) GUICtrlSetColor($input, $f) GUICtrlSetFont($edit, $s, $w, $a, $n) GUICtrlSetFont($input, $s, $w, $a, $n) Else GUICtrlSetColor($edit, $font[7]) GUICtrlSetColor($input, $font[7]) GUICtrlSetFont($edit, $font[3], $font[4], $font[1], $font[2]) GUICtrlSetFont($input, $font[3], $font[4], $font[1], $font[2]) $s = $font[3] $n = $font[2] $w = $font[4] $a = $font[1] $f = $font[7] _FileWriteToLine(@ScriptDir & "/settings.ini", 2, $font[7], 1) _FileWriteToLine(@ScriptDir & "/settings.ini", 3, $font[2], 1) _FileWriteToLine(@ScriptDir & "/settings.ini", 4, $font[3], 1) _FileWriteToLine(@ScriptDir & "/settings.ini", 5, $font[4], 1) _FileWriteToLine(@ScriptDir & "/settings.ini", 6, $font[1], 1) EndIf EndIf If $msgg = $sett Then If GUICtrlRead($ninput) <> "" Then _FileWriteToLine(@ScriptDir & "/settings.ini", 1, GUICtrlRead($ninput), 1) If $nick <> GUICtrlRead($ninput) Then UDPSend($socket, "Server: " & $nick & " changed name to " & GUICtrlRead($ninput) & ".") GUICtrlSetData($input, "") EndIf EndIf GUIDelete($gui2) ExitLoop GUICtrlSetState($ninput, $GUI_FOCUS) EndIf WEnd EndIf If $CSock[0] > 0 Then $br = "" For $n = 1 To $CSock[0] $ret2 = UDPRecv($CSock[$n], 512) If @error <> 0 Then $br = $br & $n & @LF ElseIf $ret2 <> "" Then Broadcast($ret2) EndIf Next If $br <> "" Then $br = StringSplit(StringTrimRight($br, 1), @LF) For $n = 1 To $br[0] RemoveSocket(Int($br[$n])) Next EndIf EndIf If $msg = $bsend Then $ret = UDPSend($socket, $nick & ": " & GUICtrlRead($input)) If @error Or $ret < 0 Then ExitLoop GUICtrlSetData($input, "") GUICtrlSetState($input, $GUI_FOCUS) EndIf HotKeySet("{ENTER}", "Bsend") $ret = UDPRecv($socket, 512) If @error Or $ret < 0 Then ExitLoop If StringLen($ret) > 0 Then If StringInStr($ret, "is connected.") Then If StringTrimLeft(StringTrimRight($ret, 14), 10) <> $nick Then _GUICtrlListAddItem($list, StringTrimLeft(StringTrimRight($ret, 14), 10)) EndIf EndIf If StringInStr($ret, "is disconnected.") Then _GUICtrlListDeleteItem($list, _GUICtrlListFindString($list, StringTrimLeft(StringTrimRight($ret, 17), 10), 1)) GUICtrlSetData($edit, GUICtrlRead($edit) & @CRLF & $ret) GUICtrlSendMsg($edit, $EM_SCROLLCARET, 0, 0) EndIf Sleep(1) WEnd ;loop end Func RemoveSocket($instance) Dim $aTemp[$CSock[0]] $aTemp[0] = $CSock[0] - 1 $RS_i = 1 If $aTemp[0] > 0 Then For $RS_n = 1 To $CSock[0] If $RS_n <> $instance Then $aTemp[$RS_i] = $CSock[$RS_n] $RS_i = $RS_i + 1 EndIf Next EndIf $CSock = $aTemp EndFunc ;==>RemoveSocket Func Broadcast($szData) For $B_n = 1 To $CSock[0] UDPSend($CSock[$B_n], $CSock[0] & "-" & $szData) Next EndFunc ;==>Broadcast Func OnAutoItExit() UDPSend($socket, "Server: " & $nick & " is disconnected.") If @error Or $ret < 0 Then Exit GUICtrlSetData($input, "") GUICtrlSetState($input, $GUI_FOCUS) For $n = 1 To $CSock[0] UDPCloseSocket($CSock[$n]) Next UDPCloseSocket($MainSocket) UDPShutdown() If $socket >= 0 Then UDPCloseSocket($socket) EndFunc ;==>OnAutoItExit Func AddSocket($AS_sock) $AS_n = $CSock[0] + 1 ReDim $CSock[$AS_n + 1] $CSock[0] = $AS_n $CSock[$AS_n] = $AS_sock EndFunc ;==>AddSocket Func _UDPCreateMainListeningSocket($szIP, $szPort) UDPStartup() $TCMLS_MainSocket = UDPBind($szIP, $szPort) If @error Or $TCMLS_MainSocket = -1 Then Return -1 Return $TCMLS_MainSocket EndFunc ;==>_UDPCreateMainListeningSocket Func Bsend() If WinActive("Regret's Chat") = 0 Then HotKeySet("{ENTER}") Send("{ENTER}") HotKeySet("{ENTER}", "Bsend") EndIf If WinActive("Regret's Chat") = 1 And GUICtrlRead($input) <> "" Then $ret = UDPSend($socket, $nick & ": " & GUICtrlRead($input)) GUICtrlSetData($input, "") GUICtrlSetState($input, $GUI_FOCUS) EndFunc ;==>Bsend Edited June 21, 2007 by Gmail Deal or No Deal? Link to comment Share on other sites More sharing options...
Dale2507 Posted June 15, 2007 Author Share Posted June 15, 2007 (edited) now i've got the script so that the server can send messages to 1 of the clients and both the clients can send messages to the server is there a way to send messages to both (if possible at the same time) CODE #include <GUIConstants.au3> #include <File.au3> #include <Misc.au3> #Include <GuiList.au3> Dim $ConnectedSocket = -1 Global $CSock[1] Dim $MainSocket $CSock[0] = 0 If FileExists(@scriptdir & "/settings.ini") Then Sleep(10) Else _FileCreate(@scriptdir & "/settings.ini") EndIf $nick = InputBox("K Chat Program","Enter a nickname to use when chatting") If FileReadLine(@scriptdir & "/settings.ini", 2) = "" Then _FileWriteToLine(@scriptdir & "/settings.ini", 2, "000000", 1) _FileWriteToLine(@scriptdir & "/settings.ini", 3, "Arial", 1) _FileWriteToLine(@scriptdir & "/settings.ini", 4, "9", 1) _FileWriteToLine(@scriptdir & "/settings.ini", 5, "400", 1) _FileWriteToLine(@scriptdir & "/settings.ini", 6, "1", 1) EndIf $f=FileReadLine(@scriptdir & "/settings.ini", 2) $n=FileReadLine(@scriptdir & "/settings.ini", 3) $s=FileReadLine(@scriptdir & "/settings.ini", 4) $w=FileReadLine(@scriptdir & "/settings.ini", 5) $a=FileReadLine(@scriptdir & "/settings.ini", 6) ;;;;;;;;;;;;;;;;; $port = 3333 $ipaddress = InputBox("IpAdress", "Enter the ip to connect to, leave blank if you are the server!") If $ipaddress = "" Then $Servermode = 1 $ipaddress = @ipaddress1 Else $servermode = 0 EndIf UDPStartup() If $Servermode = 1 Then $socket = UDPBind ($ipaddress, $port) Else $socket = UDPOpen ($ipaddress, $port) EndIf If $socket < 0 Then MsgBox(0,"Error","Could not connect to server") Exit Else UDPSend($socket, "Server: " & $nick & " is connected.") EndIf ;gui $gui = GUICreate($nick & "'s Chat",580,250) $menu=GuiCtrlCreateMenu("Program") $set=GuiCtrlCreateMenuItem("Settings", $menu) $menu1=GuiCtrlCreateMenuItem("Exit", $menu) $menu3=GuiCtrlCreateMenu("Help") $menu4=GuiCtrlCreateMenuItem("About", $menu3) $userlist=GuiCtrlCreateLabel("UserList:", 485, 5) $bsend = GUICtrlCreateButton("Send",380,145,60,80) $list=GuiCtrlCreateList($nick, 445, 22, 125, 213) $edit = GUICtrlCreateEdit("",5,5,435,130,BitOR($ES_AUTOVSCROLL,$WS_VSCROLL,$ES_READONLY)) GUICtrlSetFont(-1,$s,$w,$a,$n) GuiCtrlSetColor(-1, $f) GuiCtrlSetBkColor(-1, 0xffffff) $input = GUICtrlCreateEdit("",5,145,375,80,BitOR($WS_VSCROLL,$ES_AUTOVSCROLL,$ES_MULTILINE)) GUICtrlSetFont($input,$s,$w,$a,$n) GuiCtrlSetColor($input, $f) GUISetState() GUICtrlSetState($input,$GUI_FOCUS) While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then Exit If $msg = $menu1 Then Exit If $msg = $set Then $gui2=GuiCreate("Settings", 200, 100) $label=GuiCtrlCreateLabel("Nickname:", 5, 8) $ninput=GuiCtrlCreateInput("", 65, 5, 130) $label1=GuiCtrlCreateLabel("Chat Font:", 5, 41) $color=GuiCtrlCreateButton("Select", 65, 35, 130) $sett=GuiCtrlCreateButton("Ok", 65, 70, 70) GuiSetState() While 1 $msgg=GuiGetMsg() If $msgg=$Gui_Event_Close Then GuIDelete($gui2) ExitLoop EndIf If $msgg=$color then $font=_ChooseFont() If (@error) Then GuiCtrlSetColor($edit, $f) GuiCtrlSetColor($input, $f) GUICtrlSetFont($edit, $s, $w, $a, $n) GUICtrlSetFont($input, $s, $w, $a, $n) Else GuiCtrlSetColor($edit, $font[7]) GuiCtrlSetColor($input, $font[7]) GUICtrlSetFont($edit, $font[3], $font[4], $font[1], $font[2]) GUICtrlSetFont($input, $font[3], $font[4], $font[1], $font[2]) $s=$font[3] $n=$font[2] $w=$font[4] $a=$font[1] $f=$font[7] _FileWriteToLine(@scriptdir & "/settings.ini", 2, $font[7], 1) _FileWriteToLine(@scriptdir & "/settings.ini", 3, $font[2], 1) _FileWriteToLine(@scriptdir & "/settings.ini", 4, $font[3], 1) _FileWriteToLine(@scriptdir & "/settings.ini", 5, $font[4], 1) _FileWriteToLine(@scriptdir & "/settings.ini", 6, $font[1], 1) EndIf EndIf If $msgg=$sett Then If GuiCtrlRead($ninput) <> "" Then _FileWriteToLine(@scriptdir & "/settings.ini", 1, GuiCtrlReaD($ninput), 1) If $nick <> GuiCtrlReaD($ninput) Then UDPSend($socket, "Server: " & $nick & " changed name to " & GuiCtrlReaD($ninput) & ".") GUICtrlSetData($input,"") EndIf EndIf GuiDelete($gui2) ExitLoop GUICtrlSetState($ninput,$GUI_FOCUS) EndIf Wend EndIf If $CSock[0] > 0 Then $br = "" For $n = 1 to $CSock[0] $ret2 = UDPRecv($CSock[$n], 512) If @error <> 0 Then $br = $br & $n & @LF ElseIf $ret2 <> "" Then Broadcast($ret2) EndIf Next If $br <> "" Then $br = StringSplit(StringTrimRight($br,1),@LF) For $n = 1 to $br[0] RemoveSocket(Int($br[$n])) Next EndIf EndIf If $msg = $bsend Then $ret = UDPSend($socket, $nick & ": " & GUICtrlRead($input)) If @ERROR Or $ret < 0 Then ExitLoop GUICtrlSetData($input,"") GUICtrlSetState($input,$GUI_FOCUS) EndIf HotKeySet("{ENTER}", "Bsend") $ret = UDPRecv($socket, 512) If @ERROR Or $ret < 0 Then ExitLoop If StringLen($ret) > 0 Then If StringInStr($ret, "is connected.") Then If StringTrimLeft(StringTrimRight($ret, 14), 10) <> $nick Then _GuiCtrlListAddItem($list, StringTrimLeft(StringTrimRight($ret, 14), 10)) EndIf EndIf If StringInStr($ret, "is disconnected.") Then _GUICtrlListDeleteItem($list, _GuiCtrlListFindString($list, StringTrimLeft(StringTrimRight($ret, 17), 10), 1)) GUICtrlSetData($edit, GUICtrlRead($edit) & @CRLF & $ret) GUICtrlSendMsg($edit, $EM_SCROLLCARET, 0, 0) EndIf Sleep(1) WEnd ;loop end Func RemoveSocket($instance) Dim $aTemp[$CSock[0]] $aTemp[0] = $CSock[0] - 1 $RS_i = 1 If $aTemp[0] > 0 Then For $RS_n = 1 to $CSock[0] If $RS_n <> $instance Then $aTemp[$RS_i] = $CSock[$RS_n] $RS_i = $RS_i + 1 EndIf Next EndIf $CSock = $aTemp EndFunc Func Broadcast($szData) For $B_n = 1 to $CSock[0] UDPSend($CSock[$B_n],$CSock[0] & "-" & $szData) Next EndFunc Func OnAutoItExit() UDPSend($socket, "Server: " & $nick & " is disconnected.") If @ERROR Or $ret < 0 Then Exit GUICtrlSetData($input,"") GUICtrlSetState($input,$GUI_FOCUS) For $n = 1 to $CSock[0] UDPCloseSocket($CSock[$n]) Next UDPCloseSocket($MainSocket ) UDPShutDown() If $socket >= 0 Then UDPCloseSocket($socket) EndFunc Func AddSocket($AS_sock) $AS_n = $CSock[0] + 1 ReDim $CSock[$AS_n + 1] $CSock[0] = $AS_n $CSock[$AS_n] = $AS_sock EndFunc Func Bsend() If WinActive("Regret's Chat") = 0 then HotKeySet("{ENTER}") Send("{ENTER}") HotKeySet("{ENTER}", "Bsend") endif If WinActive("Regret's Chat") =1 and GUICtrlRead($input)<> "" then $ret = UDPSend($socket, $nick & ": " & GUICtrlRead($input)) GUICtrlSetData($input,"") GUICtrlSetState($input,$GUI_FOCUS) EndFunc Edited June 21, 2007 by Gmail Deal or No Deal? Link to comment Share on other sites More sharing options...
Fabry Posted June 21, 2007 Share Posted June 21, 2007 (edited) I made a chat client/server all in one, as peer to peer. This is the code of simply chat, in Italian obviously. [autoit] ;~ Autore: Fabrizio Waldner ;~ #include <IE.au3> #include <A3LLis Edited June 21, 2007 by Fabry A lan chat (Multilanguage)LanMuleFile transferTank gameTank 2 an online game[center]L'esperienza è il nome che tutti danno ai propri errori.Experience is the name everyone gives to their mistakes.Oscar Wilde[/center] Link to comment Share on other sites More sharing options...
Fabry Posted June 21, 2007 Share Posted June 21, 2007 i forgot to attach the images.Images___Immagini.rar A lan chat (Multilanguage)LanMuleFile transferTank gameTank 2 an online game[center]L'esperienza è il nome che tutti danno ai propri errori.Experience is the name everyone gives to their mistakes.Oscar Wilde[/center] Link to comment Share on other sites More sharing options...
McGod Posted June 21, 2007 Share Posted June 21, 2007 TCPAccept () needs to be polled to checked for new users. To recieve from both you need to create an array with all the sockets and loop through them. [indent][center][u]Formerly Chip[/u][/center]~UDFs~[/indent][u]IRC.au3 - Allows you to connect to IRC ServersINetCon.au3 - Connects/Disconnects/Check Status of InternetHardware Key - Creates a unique hardware hashScriptComm - Allows you to communicate between scripts using WM_COPYDATA[/u][indent]~Programs~[/indent][indent]SimonAu3ForumsIRC Bot~Web Site~Web Autoit Example[/indent][indent][b][/b][/indent][u][/u] Link to comment Share on other sites More sharing options...
Dale2507 Posted June 21, 2007 Author Share Posted June 21, 2007 how would you create an array which can have unlimited occurences? Deal or No Deal? Link to comment Share on other sites More sharing options...
Fabry Posted June 21, 2007 Share Posted June 21, 2007 (edited) You can have array of 4000 and more, i tested. Dim $array[4000] Edited June 21, 2007 by Fabry A lan chat (Multilanguage)LanMuleFile transferTank gameTank 2 an online game[center]L'esperienza è il nome che tutti danno ai propri errori.Experience is the name everyone gives to their mistakes.Oscar Wilde[/center] Link to comment Share on other sites More sharing options...
Dale2507 Posted June 21, 2007 Author Share Posted June 21, 2007 I made a chat client/server all in one, as peer to peer. This is the code of simply chat, in Italian obviously. ;~ Autore: Fabrizio Waldner;~ #include <IE.au3>#include <A3LListbox.au3>#include<Array.au3>#Include <GuiList.au3>#include<File.au3>#include <Process.au3>#Include <GuiEdit.au3>#include <GUIConstants.au3>#include<String.au3>Opt('MustDeclareVars', 1)Opt('TrayIconHide', 1)Dim $file1, $file_TX, $file_RX, $selezione, $invia[21], $input2[21], $rosso, $testocontesto, $testodummy, $bannate[64], $banno, $chiedi, $bannati[64]Dim $x, $i, $numpar, $pos, $a, $tempo, $gui2, $nomi2[21], $conf, $numconf, $arPos[10], $Nero, $giallo, $verde, $blu, $gif, $add[21]Dim $parolacce[100], $list, $selezionati[21], $utenti[21][7][21], $linea, $file2, $testo, $viola, $arancione, $emoticon, $msg4Dim $ips[7][64], $file_pro, $conferenza, $gui3, $b, $edit3[21], $fatto, $textline, $old_URL, $pixel_e, $pixel_s, $pixelsperlineDim $socket, $socket1, $socketTCP, $connectedSocket, $trilli, $cor, $max = 5, $valore, $text, $text2[40], $colore, $emo[22], $reloadDim $gooey, $edit, $input, $butt, $nomi, $cambianome, $visnome, $infutente, $aggiorna, $pulisci, $privato, $grandeitem, $rimpitem, $exititem, $Traymess, $trsmetti, $censuraDim $msg[5], $msg2, $My_ips[7], $Broadcast, $edit2, $minuti, $nuova_ver, $msg3, $censurato, $trillio, $traymesso, $ok, $annulla, $ok2, $annulla2Dim $parola, $nome, $data, $mass, $mess[8], $tempnome, $nomevec, $nomfile, $est, $file_dati, $dataTCP, $ricerca, $trillo, $versione, $gui[22]Dim $diversi, $diverso, $nascosto, $tab, $Nomeprivato, $utente, $tab1, $temtril, $temp0, $temp1, $temp2, $temp3, $tempi, $temp4, $opzioniOpt("TrayMenuMode", 1)$versione = '1.3.1'_FileCreate('Immagini\Log.html')$file1 = FileOpen('Immagini\Log.html', 130)FileWrite($file1, '<head>' & @CRLF & '<base target="_blank">' & @CRLF & '</head>' & @CRLF & '<font size=2><font color=red><span style="background-color:white"><h5><img border="0" src="15.gif" width="20" height="20"> UDP Chat versione ' & $versione & ' <img border="0" src="15.gif"width="20" height="20" ></h5></font>')FileClose($file1)Opt("RunErrorsFatal", 0)$grandeitem = TrayCreateItem("Visualizza")$rimpitem = TrayCreateItem("Nascondi")TrayCreateItem("")$exititem = TrayCreateItem("Esci")DirCreate('Immagini')FileInstall('Immagini\1.gif', 'Immagini\1.gif')FileInstall('Immagini\2.gif', 'Immagini\2.gif')FileInstall('Immagini\3.gif', 'Immagini\3.gif')FileInstall('Immagini\4.gif', 'Immagini\4.gif')FileInstall('Immagini\5.gif', 'Immagini\5.gif')FileInstall('Immagini\6.gif', 'Immagini\6.gif')FileInstall('Immagini\7.gif', 'Immagini\7.gif')FileInstall('Immagini\8.gif', 'Immagini\8.gif')FileInstall('Immagini\9.gif', 'Immagini\9.gif')FileInstall('Immagini\10.gif', 'Immagini\10.gif')FileInstall('Immagini\11.gif', 'Immagini\11.gif')FileInstall('Immagini\12.gif', 'Immagini\12.gif')FileInstall('Immagini\13.gif', 'Immagini\13.gif')FileInstall('Immagini\14.gif', 'Immagini\14.gif')FileInstall('Immagini\15.gif', 'Immagini\15.gif')FileInstall('Immagini\16.gif', 'Immagini\16.gif')FileInstall('Immagini\17.gif', 'Immagini\17.gif')FileInstall('Immagini\18.gif', 'Immagini\18.gif')FileInstall('Immagini\19.gif', 'Immagini\19.gif')FileInstall('Immagini\20.gif', 'Immagini\20.gif')FileInstall('Immagini\emo.ico', 'Immagini\emo.ico')FileInstall('Immagini\add.ico', 'Immagini\add.ico')FileInstall('Immagini\ico395.ico', 'Immagini\ico395.ico', 1)FileInstall('Immagini\ico2342.ico', 'Immagini\ico2342.ico', 1)FileInstall('Immagini\linguaggio.txt', 'Immagini\linguaggio.txt', 1)$file1 = FileOpen('Immagini\linguaggio.txt', 0)$x = 0$i = 0While 1 $i = $i + 1 $parola = FileReadLine($file1) If @error = -1 Then ExitLoop $parolacce[$i] = $parolaWEndDim $k$numpar = $i - 1FileClose($file1)$My_ips = StringSplit(@IPAddress1, '.')$Broadcast = $My_ips[1] & '.' & $My_ips[2] & '.' & $My_ips[3] & '.255'UDPStartup()$nome = @ComputerName$socket = UDPBind(@IPAddress1, 65532)If @error <> 0 Then ExitTCPStartup()$gooey = GUICreate("La mia chat - v. " & $versione, 450, 270)$tab = GUICtrlCreateTab(10, 32, 283, 174)GUICtrlCreateTabItem("Comune");~ $edit = GUICtrlCreateEdit("", 10, 57, 280, 150, $WS_VSCROLL + $ES_AUTOVSCROLL + $ES_READONLY)Global $oIE = ObjCreate("Shell.Explorer.2")Global $edit = GUICtrlCreateObj($oIE, 10, 57, 280, 150)$oIE.navigate (@ScriptDir & '\Immagini\Log.html')$oIE.silent = 1$oIE.StatusBar = True;~ GUICtrlSetResizing ($edit, $GUI_DOCKAUTO);~ GUICtrlSetBkColor($edit, 0xfffffff)$tab1 = GUICtrlCreateTabItem("Privato")$edit2 = GUICtrlCreateEdit("", 10, 57, 280, 150, $WS_VSCROLL + $ES_AUTOVSCROLL + $ES_READONLY)GUICtrlSetBkColor($edit2, 0xfffffff)GUICtrlCreateTabItem("")$trsmetti = GUICtrlCreateButton('Invia file', 370, 240, 70, 20);~ $edit = GUICtrlCreateEdit("", 10, 60, 280, 150, $WS_VSCROLL + $ES_AUTOVSCROLL + $ES_READONLY)$trillo = GUICtrlCreateButton(' ', 330, 211, 30, 30, $BS_ICON)GUICtrlSetImage($trillo, @ScriptDir & '\Immagini\ico2342.ico', -1, 0)$Nomeprivato = GUICtrlCreateLabel('', 300, 35, 200, 15)$input = GUICtrlCreateInput("", 10, 10, 200, 20)$butt = GUICtrlCreateButton("Invia", 210, 10, 80, 20, $BS_DEFPUSHBUTTON)$nomi = GUICtrlCreateList('', 300, 60, 130, 150)$cambianome = GUICtrlCreateButton("Cambia nome", 10, 220, 80, 20)$visnome = GUICtrlCreateLabel('Nome: ' & $nome, 100, 222, 150, 15)$tempi = GUICtrlCreateButton('Aggiornamenti', 215, 30, -1, 20)$infutente = GUICtrlCreateButton('Utente...', 300, 10, 70, 20)$aggiorna = GUICtrlCreateButton('Aggiorna', 370, 10, 70, 20)$pulisci = GUICtrlCreateButton('Pulisci', 10, 240, 70, 20)$opzioni = GUICtrlCreateButton('Opzioni', 80, 240, 70, 20)$conferenza = GUICtrlCreateButton('Conferenza', 150, 240, 70, 20)$testo = GUICtrlCreateButton('Testo', 170, 31, -1, 20)$emoticon = GUICtrlCreateButton('', 150, 31, 20, 20, $BS_ICON)GUICtrlSetImage($emoticon, 'Immagini\emo.ico')$reload = GUICtrlCreateButton('', 125, 31, 20, 20, $BS_ICON)GUICtrlSetImage($reload, 'Immagini\ico395.ico')$testodummy = GUICtrlCreateDummy()$testocontesto = GUICtrlCreateContextMenu($testodummy)$rosso = GUICtrlCreateMenuitem("Rosso", $testocontesto)$verde = GUICtrlCreateMenuitem("Verde", $testocontesto)$blu = GUICtrlCreateMenuitem("Blu", $testocontesto)$giallo = GUICtrlCreateMenuitem("Giallo", $testocontesto)$Nero = GUICtrlCreateMenuitem("Nero", $testocontesto)$viola = GUICtrlCreateMenuitem("Viola", $testocontesto)$arancione = GUICtrlCreateMenuitem("Arancione", $testocontesto);~ $privato = GUICtrlCreateButton('Msg privato', 370, 200, 70, 20)$ricerca = GUICtrlCreateButton('Ricerca', 370, 220, 70, 20)AutoItSetOption('TCPTimeout', 800)$socket1 = UDPOpen($Broadcast, 65532)If @error = 0 Then UDPSend($socket1, @IPAddress1 & '¤' & @ComputerName & '¤' & $nome & '¤' & _StringEncrypt(1, @UserName, 'Rodolfo') & '¤ Sono entrato.¤ ')UDPCloseSocket($socket1)GUICtrlSetTip($trsmetti, 'Invia un file ad un utente selezionandoo dalla lista')GUICtrlSetTip($input, 'Scrivi qui il messaggio che vuoi inviare. Prova a scrivere About')GUICtrlSetTip($nomi, 'Lista degli utenti in linea')GUICtrlSetTip($cambianome, 'Cambia il nome a te stesso')GUICtrlSetTip($infutente, 'Seleziona prima un utente e ricaverai alcune informazioni su di esso')GUICtrlSetTip($aggiorna, 'Aggiorna la lista degli utenti')GUICtrlSetTip($pulisci, 'Cancella tutti i nomi, dopo questo comando è consigliabile premere aggiorna')GUICtrlSetTip($Traymess, 'Ablita i messaggi quando è nascosto')GUICtrlSetTip($trilli, 'Permette di ricevere trilli')GUICtrlSetTip($tempi, 'Cerca in rete una chat più nuova')GUICtrlSetTip($reload, 'Ricarica in modo da vedere le animazioni')WinSetTrans("La mia chat - v. " & $versione, "", 0)GUISetState(@SW_SHOW)For $i = 1 To 255 Step 1 WinSetTrans("La mia chat - v. " & $versione, "", $i)Next$chiedi = True$conf = False$censurato = True$trillio = True$traymesso = True$nascosto = FalseGUICtrlSetState($input, $GUI_FOCUS)$socketTCP = TCPListen(@IPAddress1, 65531)$connectedSocket = -1$minuti = Random(0, 59, 1)While 1;~ $temp0=TimerInit() If $nascosto = True Then $msg2 = TrayGetMsg() $msg = GUIGetMsg(1) Else $msg = GUIGetMsg(1) $msg2 = 0 EndIf If $minuti = @MIN And @SEC = 2 Then Aggiornamenti() EndIf ;udprecv;~ $temp1=TimerDiff($temp0) If $msg[0] = 0 And $msg2 = 0 Then $data = UDPRecv($socket, 7000) Sleep(20) EndIf $connectedSocket = TCPAccept($socketTCP);~ $temp4=TimerDiff($temp0) If $connectedSocket > 0 Then If $file_pro[0] = 1 Then While 1 $dataTCP = TCPRecv($connectedSocket, 1677000) If $dataTCP <> '' Then If $dataTCP = 'fine' Then MsgBox(0, 'Fine', 'File completato') FileClose($file1) TCPCloseSocket($connectedSocket) $connectedSocket = -1 ExitLoop Else FileWrite($file1, $dataTCP) $dataTCP = '' EndIf EndIf WEnd Else ProgressOn('Trasferimento file', 'Inizio del trasferimento', '', -1, -1, 16) $a = 0 While $a < $file_pro[2] $dataTCP = TCPRecv($connectedSocket, 1677000) FileWrite($file1, $dataTCP);~ $a = FileGetSize($file_RX & '.' & $est) $a = BinaryLen ($dataTCP) + $a ProgressSet(Int(($a * 100) / $file_pro[2]), 'Trasferito il ' & Int($a/ (1024)) & ' KB su ' & Int($file_pro[2]/ (1024)) & ' KB.', 'Trasferimento file in corso') $dataTCP = '' WEnd ProgressOff() FileClose($file1) TCPCloseSocket($connectedSocket) $connectedSocket = -1 If $chiedi = True Then $a = MsgBox(36, 'File completato', 'File completato con successo. Si desidera aprirlo?') If $a = 6 Then _RunDOS('"' & $file_RX & '.' & $est & '"') EndIf $chiedi = True EndIf EndIf;~ $temp2=TimerDiff($temp0) Select Case $msg2 = $exititem Exit Case $msg2 = $grandeitem $nascosto = False Opt('TrayIconHide', 1) GUISetState(@SW_SHOW) GUISetState(@SW_RESTORE) For $i = 1 To $numconf GUISetState(@SW_SHOW, $gui[$i]) GUISetState(@SW_RESTORE, $gui[$i]) Next Case $msg[0] = $tab If GUICtrlRead($tab) = 1 Then GUICtrlSetData($Nomeprivato, 'Stai chattando con : ' & $utente) If GUICtrlRead($tab) = 0 Then GUICtrlSetData($Nomeprivato, '') Case $msg2 = $rimpitem $nascosto = True GUISetState(@SW_HIDE) TraySetIcon("Shell32.dll", Random(0, 100, 1)) Case $msg[0] = $GUI_EVENT_MINIMIZE Opt('TrayIconHide', 0) For $i = 1 To $numconf GUISetState(@SW_HIDE, $gui[$i]) Next GUISetState(@SW_HIDE, $gooey) $nascosto = True TraySetIcon("Shell32.dll", Random(0, 100, 1)) Case $msg[0] = $GUI_EVENT_CLOSE And $msg[1] = $gooey Exit Case $msg[0] = $GUI_EVENT_CLOSE And $msg[1] <> $gooey $i = 0 While $i <= $numconf $i = $i + 1 If $msg[1] = $gui[$i] Then ExitLoop WEnd $cor = $i $numconf = $numconf - 1 GUIDelete($gui[$cor]) For $i = 1 To $utenti[$cor][0][0] $socket1 = UDPOpen($utenti[$cor][1][$i], 65532) If @error = 0 Then UDPSend($socket1, @IPAddress1 & '¤' & @ComputerName & '¤' & $nome & '¤' & _StringEncrypt(1, @UserName, 'Rodolfo') & '¤Esco dalla conferenza¤conferenzafine¤' & $utenti[$cor][0][1]) UDPCloseSocket($socket1) Next $utenti[$cor][0][1] = '' $data = '' Case ($msg[0] = $butt) And (GUICtrlRead($input) <> '') If GUICtrlRead($input) = 'About' Then MsgBox(64, 'About', 'Questo programma è stato scritto con AutoIt v3,' & @CRLF & ' linguaggio freeware scricabile dal sito http://www.autoitscript.com/autoit3/' & @CRLF & ' Questo programma è stato scritto da Fabrizio Waldner©.' & @CRLF & ' Ringrazio coloro che lo hanno distribuito.') If GUICtrlRead($tab) = 0 Then If StringLen(GUICtrlRead($input)) <= 140 Then $data = @IPAddress1 & '¤' & @ComputerName & '¤' & $nome & '¤' & _StringEncrypt(1, @UserName, 'Rodolfo') & '¤' & GUICtrlRead($input) & '¤ ' GUICtrlSetData($input, "") If $x <= 1 Then $socket1 = UDPOpen($Broadcast, 65532) If @error = 0 Then UDPSend($socket1, $data) UDPCloseSocket($socket1) Else For $i = 1 To $x $socket1 = UDPOpen($ips[1][$i], 65532) If @error = 0 Then UDPSend($socket1, $data) UDPCloseSocket($socket1) Next EndIf $data = '' Else If GUICtrlRead($nomi) <> '' Or $utente <> '' Then $i = 0 While $i <= $x $i = $i + 1 If GUICtrlRead($nomi) <> '' Then If GUICtrlRead($nomi) = $ips[3][$i] Then ExitLoop Else If $utente = $ips[3][$i] Then ExitLoop EndIf WEnd $data = GUICtrlRead($input) $socket1 = UDPOpen($ips[1][$i], 65532) UDPSend($socket1, @IPAddress1 & '¤' & @ComputerName & '¤' & $nome & '¤' & _StringEncrypt(1, @UserName, 'Rodolfo') & '¤ (Privato): ' & $data & '¤privato') UDPCloseSocket($socket1) $utente = GUICtrlRead($nomi) GUICtrlSetData($input, '') GUICtrlSetData($Nomeprivato, 'Stai chattando con : ' & $utente) If $censurato = True Then For $k = 1 To $numpar If StringInStr($data, $parolacce[$k]) Then $data = StringReplace($data, $parolacce[$k], _StringRepeat('*', StringLen($parolacce[$k]))) EndIf Next EndIf _GUICtrlEditSetSel($edit2, 300000, 300000) GUICtrlSetData($edit2, $nome & ' > ' & $data & @CRLF, 1) $data = '' GUICtrlSetState($input, $GUI_FOCUS) Else MsgBox(8192, 'Seleziona Utente', 'Seleziona l''utente con cui vuoi chattare dalla lista dei nomi') EndIf EndIf Sleep(100) Case $data <> '' $selezione = GUICtrlRead($nomi) If IsBinary ($data) Then $mass = binarytoString ($data) Else $mass = $data EndIf $data = '' $mess = StringSplit($mass, '¤') $diversi = True For $k = 1 To $bannati[0] If $mess[1] = $bannati[$k] Then $diversi = False Next If $diversi = True Or $mess[6] = 'bye'Or $mess[6] = 'kill' Or $mess[6] = 'mast' Then ;~ _GUICtrlEditSetSel($edit, 300000, 300000) _GUICtrlEditSetSel($edit2, 300000, 300000) If $mess[6] <> 'risp' And $mess[6] <> 'versione' And $mess[6] <> 'getaggiornamenti' And $mess[6] <> 'conferenza' And $mess[6] <> 'conferenzafine' And $mess[6] <> 'privato'And $mess[6] <> 'file' And StringInStr($mess[5], ' (Privato): ') = 0 And $mess[6] <> 'filearr' And $mess[6] <> 'agg' And $mess[6] <> 'kill' And $mess[6] <> 'Mast' Then $text = $mess[5] $text = StringReplace($text, '<', '<') $text = StringReplace($text, '>', '>');~ $workmessage = StringReplace($workmessage,$tempmsg, "<font color=""" & $ucolour & """><span style=""background-color: " & $bcolour & """>" & $tempmsg3 & "</font></span>",1) If StringInStr($text, '~') <> 0 Then $text2 = StringSplit($text, '~') $text = $text2[1] For $k = 2 To $text2[0] $colore = StringMid($text2[$k], 1, 2) $b = 2 If Not StringIsDigit($colore) Or $colore > 20 Then $colore = StringMid($text2[$k], 1, 1) $b = 1 EndIf If Not StringIsDigit($colore) Then $colore = 5 $b = 0 EndIf Switch $colore Case "0" $colore = "#DFF709" Case "1" $colore = "#FF0000" Case "2" $colore = "#009300" Case "3" $colore = "#0000FC" Case "4" $colore = "#FFFF00" Case "5" $colore = "#000000" Case "6" $colore = "#9C009C" Case "7" $colore = "#FC7F00" Case "8" $colore = "#7F0000" Case "9" $colore = "#00FC00" Case "10" $colore = "#009393" Case "11" $colore = "#00FFFF" Case "12" $colore = "#00007F" Case "13" $colore = "#FF00FF" Case "14" $colore = "#7F7F7F" Case "15" $colore = "#D2D2D2" Case "16" $colore = "#55A0FF" Case "17" $colore = "#FFADA3" Case "18" $colore = "#D69807" Case "19" $colore = "#E47D64" Case "20" $colore = "#A2EDA2" EndSwitch $text2[$k] = "<font color=""" & $colore & """><span style=""background-color: #FFFFFF"">" & StringTrimLeft($text2[$k], $<img src='http://www.autoitscript.com/forum/public/style_emoticons/<#EMO_DIR#>/rolleyes.gif' class='bbc_emoticon' alt=':rolleyes:' /> & "</font></span>" $colore = 1 $text = $text & $text2[$k] Next EndIf If $censurato = True Then For $i = 1 To $numpar If StringInStr($text, $parolacce[$i]) Then $text = StringReplace($text, $parolacce[$i], _StringRepeat('*', StringLen($parolacce[$i]))) EndIf Next EndIf If StringInStr($text, 'þ') <> 0 Then $text2 = StringSplit($text, 'þ') $text = $text2[1] For $k = 2 To $text2[0] $gif = StringMid($text2[$k], 1, 2) $b = 2 If Not StringIsDigit($gif) Or $gif > 20 Then $gif = StringMid($text2[$k], 1, 1) $b = 1 EndIf If Not StringIsDigit($gif) Then $gif = 0 $b = 0 EndIf If $gif <> 7 And $gif <> 10 And $gif <> 11 And $gif <> 12 And $gif <> 13 And $gif <> 14 And $gif <> 17 Then $text2[$k] = '<img border="0" src="' & $gif & '.gif" height="20">' & StringTrimLeft($text2[$k], $<img src='http://www.autoitscript.com/forum/public/style_emoticons/<#EMO_DIR#>/rambo.gif' class='bbc_emoticon' alt=':rambo:' />; '<img border="0" src="Immagini/' & $gif & '.gif "width="20" height="20"> Else $text2[$k] = '<img border="0" src="' & $gif & '.gif" >' & StringTrimLeft($text2[$k], $<img src='http://www.autoitscript.com/forum/public/style_emoticons/<#EMO_DIR#>/sick.gif' class='bbc_emoticon' alt=':x' /> EndIf $text = $text & $text2[$k] $gif = 0 Next EndIf $linea = '<font size=2><font color="#000000"><span style="background-color:#ffffff"><b>' & $mess[3] & "</b> > " & $text & '</font></br>' $file2 = FileOpen(@ScriptDir & '\Immagini\Log.html', 129) FileWrite($file2, $linea & @CRLF & '</font></span>') FileClose($file2) $oIE.refresh $oIE.navigate (@ScriptDir & '\Immagini\Log.html') $oIE.navigate ("java script:scroll(0,9000000)") GUICtrlSetState($input, $GUI_FOCUS) EndIf If $mess[6] = 'privato' Or StringInStr($mess[5], ' (Privato): ') = 1 Then GUICtrlSetData($edit2, $mess[3] & " > " & $mess[5] & @CRLF, 1) GUICtrlSetState($tab1, $GUI_SHOW) GUICtrlSetState($input, $GUI_FOCUS) $utente = GUICtrlRead($nomi) GUICtrlSetData($Nomeprivato, 'Stai chattando con : ' & $utente) EndIf If $mess[6] <> 'risp' And $mess[6] <> 'getaggiornamenti'And $mess[6] <> 'versione' And $mess[6] <> 'conferenza' And $mess[6] <> 'conferenzafine' And $mess[6] <> 'file' And $mess[6] <> 'filearr' And $mess[6] <> 'agg' And $mess[6] <> 'kill' And $mess[6] <> 'Mast' And $nascosto = True And $traymesso = True Then TrayTip($mess[3] & " : ", $mess[5], 10) $diversi = True For $i = 1 To $x If $mess[1] = $ips[1][$i] Then $diversi = False $ips[2][$i] = $mess[2] $tempnome = $ips[3][$i] $ips[3][$i] = $mess[3] $ips[4][$i] = $mess[4] EndIf Next If $diversi = True Then $x = $x + 1 $i = 1 While $i <= $x If $ips[1][$i] = '' Then $ips[1][$i] = $mess[1];IP $ips[2][$i] = $mess[2];Nome computer $ips[3][$i] = $mess[3];nome $ips[4][$i] = $mess[4];User _GUICtrlListAddItem($nomi, $ips[3][$i]) ExitLoop EndIf $i = $i + 1 WEnd Else $pos = _GUICtrlListSelectString($nomi, $tempnome) If Not ($pos == $LB_ERR) Then _GUICtrlListReplaceString($nomi, $pos, $mess[3]) EndIf EndIf If StringInStr($mess[5], ' Sono entrato.') = 1 Then For $i = 1 To $x $socket1 = UDPOpen($mess[1], 65532) If @error = 0 Then UDPSend($socket1, $ips[1][$i] & '¤' & $ips[2][$i] & '¤' & $ips[3][$i] & '¤' & $ips[4][$i] & '¤ .¤risp') UDPCloseSocket($socket1) Next EndIf If $mess[6] = 'bye' Then $pos = _GUICtrlListSelectString($nomi, $mess[3]) _GUICtrlListDeleteItem($nomi, $pos) For $i = 1 To $x If $mess[1] = $ips[1][$i] Then $ips[1][$i] = '' $ips[2][$i] = '' $ips[3][$i] = '' $ips[4][$i] = '' $ips[6][$i] = '' EndIf Next $x = $x - 1 EndIf $i = $x + 2 While $i > 0 $i = $i - 1 If $ips[1][$i] <> '' Then $k = 0 While $k < $x + 2 $k = $k + 1 If $k >= $i Then ExitLoop If $ips[1][$k] = '' Then $ips[1][$k] = $ips[1][$i] $ips[2][$k] = $ips[2][$i] $ips[3][$k] = $ips[3][$i] $ips[4][$k] = $ips[4][$i] $ips[6][$k] = $ips[6][$i] $ips[1][$i] = '' $ips[2][$i] = '' $ips[3][$i] = '' $ips[4][$i] = '' $ips[6][$i] = '' ExitLoop 2 EndIf WEnd EndIf WEnd If $mess[6] = 'agg' And $mess[1] <> @IPAddress1 Then For $i = 1 To $x $socket1 = UDPOpen($Broadcast, 65532) If @error = 0 Then UDPSend($socket1, $ips[1][$i] & '¤' & $ips[2][$i] & '¤' & $ips[3][$i] & '¤' & $ips[4][$i] & '¤ .¤risp') UDPCloseSocket($socket1) Next $socket1 = UDPOpen($mess[1], 65532) If @error = 0 Then UDPSend($socket1, @IPAddress1 & '¤' & @ComputerName & '¤' & $nome & '¤' & _StringEncrypt(1, @UserName, 'Rodolfo') & '¤ .¤risp') UDPCloseSocket($socket1) $socket1 = UDPOpen($Broadcast, 65532) If @error = 0 Then UDPSend($socket1, @IPAddress1 & '¤' & @ComputerName & '¤' & $nome & '¤' & _StringEncrypt(1, @UserName, 'Rodolfo') & '¤ .¤risp') UDPCloseSocket($socket1) EndIf If $mess[6] = 'file' Then $file_pro = StringSplit($mess[5], 'ø') If $file_pro[0] <> 1 Then $a = MsgBox(52 + 8192, 'Trasferimento file', 'L''utente ' & $mess[3] & ' sta inviando il seguente file: ' & @CRLF & 'Nome file: ' & $file_pro[1] & @CRLF & 'Dimensione: ' & Int($file_pro[2] / 1024) & ' KB' & @CRLF & 'Si desidera accettare?') Else $a = MsgBox(52 + 8192, 'Trasferimento file', 'L''utente ' & $mess[3] & ' sta inviando il seguente file: ' & @CRLF & 'Nome file: ' & $file_pro[1] & @CRLF & 'Si desidera accettare?') EndIf;~ $a = MsgBox(52, 'Trasferimento file', 'L''utente ' & $mess[3] & ' sta inviando il seguente file: '&@CRLF &'Nome file: '& $mess[5] &@CRLF& 'Si desidera accettare?') If $a = 6 Then $nomfile = StringSplit($file_pro[1], '.') $est = $nomfile[$nomfile[0]] ;$connectedSocket = TCPAccept($socketTCP) ;$dataTCP = TCPRecv($connectedSocket, 167772160) $file_RX = FileSaveDialog('Ricevi file', @WorkingDir & '\', 'Qualsiasi (*.' & $est & ')', -1, $nomfile[1]) _FileCreate($file_RX & '.' & $est) $file1 = FileOpen($file_RX & '.' & $est, 18) $socket1 = UDPOpen($mess[1], 65532) UDPSend($socket1, @IPAddress1 & '¤' & @ComputerName & '¤' & $nome & '¤' & _StringEncrypt(1, @UserName, 'Rodolfo') & '¤' & 'Accetto il file.' & '¤filerisp') UDPCloseSocket($socket1) EndIf EndIf If $mess[6] = 'getaggiornamenti' Then Aggiornamenti() EndIf If $mess[6] = 'filerisp' Then $file1 = FileOpen($file_TX, 16) $file_dati = FileRead($file1) If FileGetSize($file_TX) < 4000000 Then $tempo = 7000 Else $tempo = 12000 EndIf FileClose($file1) $socket1 = 0 Do $socket1 = TCPConnect($mess[1], 65531) Until $socket1 <> 0 Sleep(1000) TCPSend($socket1, $file_dati) Sleep($tempo) TCPSend($socket1, 'fine') TCPCloseSocket($socket1) EndIf If $mess[6] = 'trillo' And $trillio = True Then MsgBox(64 + 8192, 'Trillo', 'L''utente ' & $mess[3] & ' chiede la tua attenzione.', 6) EndIf If $mess[6] = 'versione' And $mess[1] <> @IPAddress1 Then $file_pro = StringSplit($mess[5], 'ø') If ($file_pro[1] > $versione) And ($nuova_ver <> $file_pro[1]) Then $nuova_ver = $file_pro[1] DirCreate(@ScriptDir & '\Udp Chat ver. ' & $nuova_ver) $file_RX = @ScriptDir & '\Udp Chat ver. ' & $nuova_ver & '\Udp Chat' $est = 'exe' _FileCreate($file_RX & '.' & $est) $file1 = FileOpen($file_RX & '.' & $est, 18) $chiedi = False $socket1 = UDPOpen($mess[1], 65532) $data = @IPAddress1 & '¤' & @ComputerName & '¤' & $nome & '¤' & _StringEncrypt(1, @UserName, 'Rodolfo') & '¤Accetto la nuova versione.¤versionerisp' UDPSend($socket1, $data) UDPCloseSocket($socket1) EndIf EndIf If $mess[6] = 'versionerisp' Then $file1 = FileOpen(@AutoItExe, 16) $file_dati = FileRead($file1) If FileGetSize(@AutoItExe) < 4000000 Then $tempo = 7000 Else $tempo = 12000 EndIf FileClose($file1) $socket1 = 0 Do $socket1 = TCPConnect($mess[1], 65531) Until $socket1 <> 0 Sleep(1000) TCPSend($socket1, $file_dati) TCPCloseSocket($socket1) EndIf If $mess[6] = 'conferenza' Then If $numconf < $max Then If $conf = True Then $i = 0 While $i <= $numconf $i = $i + 1 If $utenti[$i][0][1] = $mess[7] Then ExitLoop WEnd $cor = $i If $i > $numconf Then $numconf = $numconf + 1 $utenti[$numconf][0][1] = $mess[7] $gui[$numconf] = GUICreate('Conferenza ' & $numconf, 450, 270) $edit3[$numconf] = GUICtrlCreateEdit("", 10, 57, 280, 150, $WS_VSCROLL + $ES_AUTOVSCROLL + $ES_READONLY) GUICtrlSetBkColor($edit3[$numconf], 0xfffffff) $input2[$numconf] = GUICtrlCreateInput("", 10, 10, 200, 20) $invia[$numconf] = GUICtrlCreateButton("Invia", 210, 10, 80, 20, $BS_DEFPUSHBUTTON) $add[$numconf] = GUICtrlCreateButton('', 300, 10, 30, 30, $BS_ICON) GUICtrlSetImage($add[$numconf], @ScriptDir & '\Immagini\add.ico') GUICtrlSetTip($add[$numconf], 'Aggiunge una o più persone alla conferenza') $nomi2[$numconf] = GUICtrlCreateList('', 300, 60, 130, 150) _GUICtrlListAddItem($nomi2[$numconf], $mess[3]) $utenti[$numconf][0][0] = $utenti[$numconf][0][0] + 1 $utenti[$numconf][1][$utenti[$numconf][0][0]] = $mess[1] $utenti[$numconf][3][$utenti[$numconf][0][0]] = $mess[3] GUISetState(@SW_SHOW) $conf = True Else $diversi = True For $k = 1 To $utenti[$cor][0][0] If $mess[1] = $utenti[$cor][1][$k] Then $diversi = False Next If $diversi = True Then _GUICtrlListAddItem($nomi2[$cor], $mess[3]) $utenti[$cor][0][0] = $utenti[$cor][0][0] + 1 $utenti[$cor][1][$utenti[$cor][0][0]] = $mess[1] $utenti[$cor][3][$utenti[$cor][0][0]] = $mess[3] EndIf EndIf Else $numconf = $numconf + 1 $conf = True $utenti[$numconf][0][1] = $mess[7] $gui[$numconf] = GUICreate('Conferenza ' & $numconf, 450, 270) $edit3[$numconf] = GUICtrlCreateEdit("", 10, 57, 280, 150, $WS_VSCROLL + $ES_AUTOVSCROLL + $ES_READONLY) GUICtrlSetBkColor($edit3[$numconf], 0xfffffff) $input2[$numconf] = GUICtrlCreateInput("", 10, 10, 200, 20) $invia[$numconf] = GUICtrlCreateButton("Invia", 210, 10, 80, 20, $BS_DEFPUSHBUTTON) $add[$numconf] = GUICtrlCreateButton('', 300, 10, 30, 30, $BS_ICON) GUICtrlSetImage($add[$numconf], @ScriptDir & '\Immagini\add.ico') GUICtrlSetTip($add[$numconf], 'Aggiunge una o più persone alla conferenza') $nomi2[$numconf] = GUICtrlCreateList('', 300, 60, 130, 150) _GUICtrlListAddItem($nomi2[$numconf], $mess[3]) $utenti[$numconf][0][0] = $utenti[$numconf][0][0] + 1 $utenti[$numconf][1][$utenti[$numconf][0][0]] = $mess[1] $utenti[$numconf][3][$utenti[$numconf][0][0]] = $mess[3] GUISetState(@SW_SHOW) EndIf GUICtrlSetData($edit3[$cor], $mess[3] & " > " & $mess[5] & @CRLF, 1) GUICtrlSetState($input2[$cor], $GUI_FOCUS) EndIf EndIf If $mess[6] = 'conferenzafine' And $conf = True Then $i = 0 While $i <= $numconf $i = $i + 1 If $utenti[$i][0][1] = $mess[7] Then ExitLoop WEnd $cor = $i If $cor <= $numconf Then GUICtrlSetData($edit3[$cor], $mess[3] & " > " & $mess[5] & @CRLF, 1) $pos = _GUICtrlListSelectString($nomi2[$cor], $mess[3]) _GUICtrlListDeleteItem($nomi2[$cor], $pos) For $i = 1 To $utenti[$cor][0][0] If $mess[1] = $utenti[$cor][1][$i] Then $utenti[$cor][0][$i] = '' $utenti[$cor][1][$i] = '' $utenti[$cor][2][$i] = '' $utenti[$cor][3][$i] = '' EndIf Next $utenti[$cor][0][0] = $utenti[$cor][0][0] - 1 $i = $utenti[$cor][0][0] + 2 While $i > 0 $i = $i - 1 If $utenti[$cor][1][$i] <> '' Then $k = 0 While $k < $utenti[$cor][0][0] + 2 $k = $k + 1 If $k >= $i Then ExitLoop If $utenti[$cor][1][$k] = '' Then $utenti[$cor][1][$k] = $utenti[$cor][1][$i] $utenti[$cor][2][$k] = $utenti[$cor][2][$i] $utenti[$cor][3][$k] = $utenti[$cor][3][$i] $utenti[$cor][4][$k] = $utenti[$cor][4][$i] $utenti[$cor][1][$i] = '' $utenti[$cor][2][$i] = '' $utenti[$cor][3][$i] = '' $utenti[$cor][4][$i] = '' ExitLoop 2 EndIf WEnd EndIf WEnd EndIf EndIf If $mess[6] = 'kill' Then MsgBox(16, 'Disconnessione', 'Sei stato disconnesso dall''amministratore.') $socket1 = UDPOpen($Broadcast, 65532) If @error = 0 Then UDPSend($socket1, @IPAddress1 & '¤' & @ComputerName & '¤' & $nome & '¤' & _StringEncrypt(1, @UserName, 'Rodolfo') & '¤ L''amministratore mi ha disconnesso.¤bye') UDPCloseSocket($socket1) Exit EndIf EndIf _GUICtrlListSelectString($nomi, $selezione) Case $msg[0] = $pulisci For $i = 0 To 63 $ips[1][$i] = '' $ips[2][$i] = '' $ips[3][$i] = '' $ips[4][$i] = '' $ips[6][$i] = '' Next GUICtrlSetData($nomi, '') $x = 0 Case $msg[0] = $tempi $data = @IPAddress1 & '¤' & @ComputerName & '¤' & $nome & '¤' & _StringEncrypt(1, @UserName, 'Rodolfo') & '¤ Desidero avere aggiornamenti¤getaggiornamenti' If $x <= 1 Then $socket1 = UDPOpen($Broadcast, 65532) If @error = 0 Then UDPSend($socket1, $data) UDPCloseSocket($socket1) Else For $i = 1 To $x $socket1 = UDPOpen($ips[1][$i], 65532) If @error = 0 Then UDPSend($socket1, $data) UDPCloseSocket($socket1) Next EndIf $data = '' Case $msg[0] = $infutente If GUICtrlRead($nomi) <> '' Then $i = 0 While $i <= $x $i = $i + 1 If GUICtrlRead($nomi) = $ips[3][$i] Then ExitLoop WEnd MsgBox(8192, 'Informazioni utente', 'Nome: ' & $ips[3][$i] & @CRLF & 'Nome PC: ' & $ips[2][$i] & @CRLF & 'IP: ' & $ips[1][$i]) Else MsgBox(8192, 'Seleziona utente', 'Devi prima selezionare l''utente per avere le informazioni.') EndIf #cs Case $msg[0] = $privato If GUICtrlRead($nomi) <> '' Then $data = InputBox('Messaggio Privato', 'Insersci qui il messaggio da inviare all''utente selezionato.', '', '', 330, 150) $i = 0 While $i <= $x $i = $i + 1 If GUICtrlRead($nomi) = $ips[3][$i] Then ExitLoop WEnd $socket1 = UDPOpen($ips[1][$i], 65532) UDPSend($socket1, @IPAddress1 & '¤' & @ComputerName & '¤' & $nome & '¤' & _StringEncrypt ( 1, @username, 'Rodolfo' ) & '¤ (Privato): ' & $data & '¤privato') UDPCloseSocket($socket1) If GUICtrlRead($censura) = $GUI_CHECKED Then For $k = 1 To $numpar If StringInStr($data, $parolacce[$k]) Then $data = StringReplace($data, $parolacce[$k], _StringRepeat('*', StringLen($parolacce[$k]))) EndIf Next EndIf GUICtrlSetData($edit, $nome & ' > ' & $ips[3][$i] & ' : ' & $data & @CRLF, 1) $data = '' GUICtrlSetState($input, $GUI_FOCUS) Else MsgBox(0, 'Seleziona utente', 'Devi prima selezionare l''utente per inviare un messaggio.') EndIf #ce Case $msg[0] = $emoticon $gui3 = GUICreate('Emoticons', 200, 200) GUISetIcon(@ScriptDir & '\Immagini\emo.ico', Default, $gui3) $i = 0 For $j = 0 To 3 For $k = 0 To 4 $i += 1 $emo[$i] = GUICtrlCreateButton($i, $k * 40 + 10, $j * 43 + 30, 20, 20) GUICtrlCreatePic(@ScriptDir & '\Immagini\' & $i & '.gif', $k * 40 + 10, $j * 43 + 10, 16, 16) Next Next GUISetState(@SW_SHOW) While 1 $msg3 = GUIGetMsg() Select Case $msg3 = $GUI_EVENT_CLOSE ExitLoop Case $msg3 <> $GUI_EVENT_CLOSE And $msg3 <> 0 $i = 0 While $i <= 20 $i += 1 If $msg3 = $emo[$i] Then GUICtrlSetData($input, 'þ' & $i, 1) ExitLoop 2 EndIf WEnd EndSelect WEnd GUIDelete($gui3) GUICtrlSetState($input, $GUI_FOCUS) Send('{end}') Case $msg[0] = $testo ShowMenu($gooey, $msg[0], $testocontesto) Case $msg[0] = $rosso GUICtrlSetData($input, '~1', 1) GUICtrlSetState($input, $GUI_FOCUS) Send('{end}') Case $msg[0] = $verde GUICtrlSetData($input, '~2', 1) GUICtrlSetState($input, $GUI_FOCUS) Send('{end}') Case $msg[0] = $blu GUICtrlSetData($input, '~3', 1) GUICtrlSetState($input, $GUI_FOCUS) Send('{end}') Case $msg[0] = $giallo GUICtrlSetData($input, '~4', 1) GUICtrlSetState($input, $GUI_FOCUS) Send('{end}') Case $msg[0] = $Nero GUICtrlSetData($input, '~5', 1) GUICtrlSetState($input, $GUI_FOCUS) Send('{end}') Case $msg[0] = $viola GUICtrlSetData($input, '~6', 1) GUICtrlSetState($input, $GUI_FOCUS) Send('{end}') Case $msg[0] = $arancione GUICtrlSetData($input, '~7', 1) GUICtrlSetState($input, $GUI_FOCUS) Send('{end}') Case $msg[0] = $opzioni $gui2 = GUICreate('Opzioni', 200, 200, -1, -1, -1, -1, $gooey) $Traymess = GUICtrlCreateCheckbox('Abilita Messaggi in Tray Icon', 10, 10) $censura = GUICtrlCreateCheckbox('Abilita Censura', 10, 30, -1, -1) $trilli = GUICtrlCreateCheckbox('Trilli', 10, 50, -1, -1) $valore = GUICtrlCreateInput($max, 10, 73, -1, -1, $ES_NUMBER) GUICtrlCreateUpdown($valore) GUICtrlCreateLabel('Numero di conferenze', 53, 78) If $censurato = True Then GUICtrlSetState($censura, $GUI_CHECKED) If $traymesso = True Then GUICtrlSetState($Traymess, $GUI_CHECKED) If $trillio = True Then GUICtrlSetState($trilli, $GUI_CHECKED) GUICtrlSetTip($censura, 'Abilita la censura, ma ricorda solo a te stesso') GUICtrlSetTip($ricerca, 'Con questo comando puoi trovare utenti di altre classi') GUICtrlSetTip($trillo, 'Trilla la persona selezionata') $banno = GUICtrlCreateButton('Blocca persone', 10, 95) GUICtrlSetTip($banno, 'Blocca qualunque messaggio proveniente da una lista nera') $ok = GUICtrlCreateButton('Salva', 20, 170, 50) $annulla = GUICtrlCreateButton('Annulla', 70, 170, 50) GUISetState(@SW_SHOW) While 1 $msg3 = GUIGetMsg() Select Case $msg3 = $annulla ExitLoop Case $msg3 = $GUI_EVENT_CLOSE ExitLoop Case $msg3 = $banno $gui3 = GUICreate('Blocca persone', 200, $x * 20 + 80) GUICtrlCreateLabel('Seleziona le persone da bloccare :', 10, 10) For $k = 1 To $x $bannate[$k] = GUICtrlCreateCheckbox($ips[3][$k], 10, $k * 20 + 10) For $j = 1 To $bannati[0] If $ips[1][$k] = $bannati[$j] Then GUICtrlSetState($bannate[$k], $GUI_CHECKED) Next Next $ok2 = GUICtrlCreateButton('Salva', 10, $k * 20 + 20) $annulla2 = GUICtrlCreateButton('Annulla', 50, $k * 20 + 20) GUISetState(@SW_SHOW) While 1 $msg4 = GUIGetMsg() Select Case $msg4 = $GUI_EVENT_CLOSE ExitLoop Case $msg4 = $annulla2 ExitLoop Case $msg4 = $ok2 $j = 0 For $k = 1 To $x If GUICtrlRead($bannate[$k]) = $GUI_CHECKED Then $j += 1 $bannati[$j] = $ips[1][$k] $socket1 = UDPOpen($ips[1][$k], 65532) UDPSend($socket1, @IPAddress1 & '¤' & @ComputerName & '¤' & $nome & '¤' & _StringEncrypt(1, @UserName, 'Rodolfo') & '¤ Ti ho escluso ¤') UDPCloseSocket($socket1) EndIf Next $bannati[0] = $j ExitLoop EndSelect WEnd GUIDelete($gui3) Case $msg3 = $ok If GUICtrlRead($censura) = $GUI_CHECKED Then $censurato = True Else $censurato = False EndIf If GUICtrlRead($trilli) = $GUI_CHECKED Then $trillio = True Else $trillio = False EndIf If GUICtrlRead($Traymess) = $GUI_CHECKED Then $traymesso = True Else $traymesso = False EndIf $max = GUICtrlRead($valore) ExitLoop EndSelect WEnd GUIDelete($gui2) Case $msg[0] = $trillo $i = 0 While $i <= $x $i = $i + 1 If GUICtrlRead($nomi) = $ips[3][$i] Then ExitLoop WEnd If GUICtrlRead($nomi) <> '' Then If TimerDiff($ips[5][$i]) >= 60000 Or TimerDiff($ips[5][$i]) = 0 Then $socket1 = UDPOpen($ips[1][$i], 65532) UDPSend($socket1, @IPAddress1 & '¤' & @ComputerName & '¤' & $nome & '¤' & _StringEncrypt(1, @UserName, 'Rodolfo') & '¤ Ti trillo.¤trillo') $ips[5][$i] = TimerInit() Else MsgBox(8192, 'Smettila', 'Non puoi trillare più di una volta in un minuto') EndIf Else MsgBox(8192, 'Seleziona utente', 'Devi prima selezionare l''utente a cui vuoi trillare.') EndIf Sleep(200) #cs Case $msg[0] = $tempi $minuti = @MIN + 1 MsgBox(0, 'minuti', $minuti) #ce Case $msg[0] = $trsmetti $i = 0 While $i <= $x $i = $i + 1 If GUICtrlRead($nomi) = $ips[3][$i] Then ExitLoop WEnd If GUICtrlRead($nomi) <> '' And GUICtrlRead($nomi) <> $nome Then $file_TX = FileOpenDialog('Scegli File da inviare', @WorkingDir & '\', 'Qualsiasi (*.*)', 3) If FileGetSize($file_TX) <= 167700000 And $file_TX <> '' Then $nomfile = StringSplit($file_TX, '\') $socket1 = UDPOpen($ips[1][$i], 65532) UDPSend($socket1, @IPAddress1 & '¤' & @ComputerName & '¤' & $nome & '¤' & _StringEncrypt(1, @UserName, 'Rodolfo') & '¤' & $nomfile[$nomfile[0]] & 'ø' & FileGetSize($file_TX) & '¤file') UDPCloseSocket($socket1) Else MsgBox(48 + 8192, 'Attenzione', 'File troppo grande o inesistente') EndIf Else MsgBox(8192, 'Seleziona utente', 'Devi prima selezionare l''utente per inviare un file. Ricorda che non puoi selezionare te stesso.') EndIf Sleep(100);~ Case $msg[0] = $privato;~ MsgBox(0,'Tempi',$temp1&@CRLF&$temp4&@CRLF&$temp2&@CRLF&$temp3) Case $msg[0] = $aggiorna For $i = 1 To $x $socket1 = UDPOpen($Broadcast, 65532) If @error = 0 Then UDPSend($socket1, $ips[1][$i] & '¤' & $ips[2][$i] & '¤' & $ips[3][$i] & '¤' & $ips[4][$i] & '¤ .¤risp') UDPCloseSocket($socket1) Next $socket1 = UDPOpen($Broadcast, 65532) If @error = 0 Then UDPSend($socket1, @IPAddress1 & '¤' & @ComputerName & '¤' & $nome & '¤' & _StringEncrypt(1, @UserName, 'Rodolfo') & '¤ Mi sto æggiornando.¤agg') UDPCloseSocket($socket1) Case $msg[0] = $ricerca ProgressOn('Ricerca...', 'Ricerca in corso degli host', '', -1, -1, 16) For $k = 1 To 40 For $i = 1 To 100 $socket1 = UDPOpen('192.168.' & $k & '.' & $i, 65532) If @error = 0 Then UDPSend($socket1, @IPAddress1 & '¤' & @ComputerName & '¤' & $nome & '¤' & _StringEncrypt(1, @UserName, 'Rodolfo') & '¤ Mi sto æggiornando.¤agg') UDPCloseSocket($socket1) ProgressSet($k * 2.5, 'Ricerca al ' & $k * 2.5 & '%', 'Mi connetto con 192.168.' & $k & '.' & $i) Next Next ProgressOff() Case $msg[0] = $conferenza If $numconf < $max Then $numconf = $numconf + 1 $gui2 = GUICreate('Seleziona dalla lista', 200, 200, -1, -1, -1, -1, $gooey) $list = _Listbox_Create ($gui2, 2, 2, 194, 170, BitOR($LBS_STANDARD, $LBS_EXTENDEDSEL)) _ListBox_BeginUpdate ($list) For $i = 1 To $x _Listbox_AddString ($list, $ips[3][$i]) Next _ListBox_EndUpdate ($list) GUISetState(@SW_SHOW) $ok = GUICtrlCreateButton('Ok', 10, 170, 50) $annulla = GUICtrlCreateButton('Annulla', 60, 170, 50) GUICtrlCreateLabel('Tieni premuto ctrl', 110, 170) While 1 $msg3 = GUIGetMsg() Select Case $msg3 = $annulla $numconf = $numconf - 1 $b = 0 ExitLoop Case $msg3 = $GUI_EVENT_CLOSE $numconf = $numconf - 1 $b = 0 ExitLoop Case $msg3 = $ok $selezionati = _Listbox_GetSelItems ($list) $utenti[$numconf][0][0] = $selezionati[0] $utenti[$numconf][0][1] = @MDAY & ':' & @HOUR & ':' & @MIN & ':' & @SEC & ':' & Random(00, 99, 1) If $utenti[$numconf][0][0] > 0 Then $fatto = False For $i = 1 To $utenti[$numconf][0][0] $k = 0 While $k <= $x $k = $k + 1 If _Listbox_GetText ($list, $selezionati[$i]) = $ips[3][$k] Then ExitLoop WEnd $selezionati[$i] = _Listbox_GetText ($list, $selezionati[$i]) $utenti[$numconf][3][$i] = $ips[3][$k] $utenti[$numconf][1][$i] = $ips[1][$k] If $utenti[$numconf][1][$i] = @IPAddress1 Then $fatto = True Next If $fatto = False Then $utenti[$numconf][0][0] = $utenti[$numconf][0][0] + 1 $utenti[$numconf][1][$utenti[$numconf][0][0]] = @IPAddress1 $utenti[$numconf][3][$utenti[$numconf][0][0]] = $nome EndIf $b = 1 ExitLoop EndIf $numconf = $numconf - 1 $b = 0 ExitLoop Sleep(20) EndSelect WEnd GUIDelete($gui2) If $b = 1 Then $gui[$numconf] = GUICreate('Conferenza ' & $numconf, 450, 270) $edit3[$numconf] = GUICtrlCreateEdit("", 10, 57, 280, 150, $WS_VSCROLL + $ES_AUTOVSCROLL + $ES_READONLY) GUICtrlSetBkColor($edit3[$numconf], 0xfffffff) $input2[$numconf] = GUICtrlCreateInput("", 10, 10, 200, 20) $add[$numconf] = GUICtrlCreateButton('', 300, 10, 30, 30, $BS_ICON) GUICtrlSetImage($add[$numconf], @ScriptDir & '\Immagini\add.ico') GUICtrlSetTip($add[$numconf], 'Aggiunge una o più persone alla conferenza') $invia[$numconf] = GUICtrlCreateButton("Invia", 210, 10, 80, 20, $BS_DEFPUSHBUTTON) $nomi2[$numconf] = GUICtrlCreateList('', 300, 60, 130, 150) For $i = 1 To $utenti[$numconf][0][0] _GUICtrlListAddItem($nomi2[$numconf], $utenti[$numconf][3][$i]) Next GUISetState(@SW_SHOW) $conf = True $data = @IPAddress1 & '¤' & @ComputerName & '¤' & $nome & '¤' & _StringEncrypt(1, @UserName, 'Rodolfo') & '¤Ho iniziato la conferenza¤conferenza¤' & $utenti[$numconf][0][1] For $i = 1 To $utenti[$numconf][0][0] $socket1 = UDPOpen($utenti[$numconf][1][$i], 65532);da cambiare l'indice e gli ip If @error = 0 Then UDPSend($socket1, $data) UDPCloseSocket($socket1) Next For $k = 1 To $utenti[$numconf][0][0] $data = $utenti[$numconf][1][$k] & '¤' & @ComputerName & '¤' & $utenti[$numconf][3][$k] & '¤' & _StringEncrypt(1, @UserName, 'Rodolfo') & '¤Ho accettato la conferenza¤conferenza¤' & $utenti[$numconf][0][1] For $i = 1 To $utenti[$numconf][0][0] $socket1 = UDPOpen($utenti[$numconf][1][$i], 65532);da cambiare l'indice e gli ip If @error = 0 Then UDPSend($socket1, $data) UDPCloseSocket($socket1) Next Next $data = '' GUICtrlSetState($input2[$numconf], $GUI_FOCUS) EndIf Else MsgBox(16, 'Attenzione', 'Raggiunto numero massimo per le conferenze.') EndIf Case $msg[1] <> $gooey $i = 0 While $i <= $numconf $i = $i + 1 If $msg[0] = $invia[$i] Then ExitLoop WEnd $cor = $i If $i <= $numconf Then If StringLen(GUICtrlRead($input2[$cor])) <= 140 Then $data = @IPAddress1 & '¤' & @ComputerName & '¤' & $nome & '¤' & _StringEncrypt(1, @UserName, 'Rodolfo') & '¤' & GUICtrlRead($input2[$cor]) & '¤conferenza¤' & $utenti[$cor][0][1] GUICtrlSetData($input2[$cor], '') For $i = 1 To $utenti[$numconf][0][0] $socket1 = UDPOpen($utenti[$numconf][1][$i], 65532);da cambiare l'indice e gli ip If @error = 0 Then UDPSend($socket1, $data) UDPCloseSocket($socket1) Next $data = '' EndIf $i = 0 While $i <= $numconf $i = $i + 1 If $msg[0] = $add[$i] Then ExitLoop WEnd $cor = $i If $i <= $numconf Then $gui2 = GUICreate('Seleziona dalla lista', 200, 200, -1, -1, -1, -1, $gooey) $list = _Listbox_Create ($gui2, 2, 2, 194, 170, BitOR($LBS_STANDARD, $LBS_EXTENDEDSEL)) _ListBox_BeginUpdate ($list) For $i = 1 To $x _Listbox_AddString ($list, $ips[3][$i]) Next _ListBox_EndUpdate ($list) GUISetState(@SW_SHOW) $ok = GUICtrlCreateButton('Ok', 10, 170, 50) $annulla = GUICtrlCreateButton('Annulla', 60, 170, 50) GUICtrlCreateLabel('Tieni premuto ctrl', 110, 170) While 1 $msg3 = GUIGetMsg() Select Case $msg3 = $annulla $b = 0 ExitLoop Case $msg3 = $GUI_EVENT_CLOSE $b = 0 ExitLoop Case $msg3 = $ok $selezionati = _Listbox_GetSelItems ($list) For $i = 1 To $selezionati[0] $k = 0 While $k <= $x $k = $k + 1 If _Listbox_GetText ($list, $selezionati[$i]) = $ips[3][$k] Then ExitLoop WEnd $selezionati[$i] = _Listbox_GetText ($list, $selezionati[$i]) $utenti[$numconf][3][$i] = $ips[3][$k] $utenti[$numconf][1][$i] = $ips[1][$k] If $utenti[$numconf][1][$i] = @IPAddress1 Then $fatto = True Next If $fatto = False Then $utenti[$numconf][0][0] = $utenti[$numconf][0][0] + 1 $utenti[$numconf][1][$utenti[$numconf][0][0]] = @IPAddress1 $utenti[$numconf][3][$utenti[$numconf][0][0]] = $nome EndIf $b = 1 ExitLoop $numconf = $numconf - 1 $b = 0 ExitLoop Sleep(20) EndSelect WEnd GUIDelete($gui2) EndIf Case $msg[0] = $reload $oIE.navigate (@ScriptDir & '\Immagini\Log.html') Case $msg[0] = $cambianome $nomevec = $nome $nome = InputBox('Nome', 'Inserisci Nickname per la chat', '', ' M20', 300, 110) If @error <> 1 Then $diverso = True For $k = 0 To $x If $nome = $ips[3][$k] Then $diverso = False Next While ($nome = '') Or (StringInStr($nome, ' ') = 1) Or $diverso = False $nome = InputBox('Nome', 'Inserisci Nickname per la chat', '', ' M20', 300, 110) If @error <> 1 Then $diverso = True For $k = 0 To $x If $nome = $ips[3][$k] Then $diverso = False Next Else $nome = $nomevec ExitLoop EndIf WEnd Else $nome = $nomevec EndIf GUICtrlSetData($visnome, 'Nome: ' & $nome) $socket1 = UDPOpen($Broadcast, 65532) If @error = 0 Then UDPSend($socket1, @IPAddress1 & '¤' & @ComputerName & '¤' & $nomevec & '¤' & _StringEncrypt(1, @UserName, 'Rodolfo') & '¤ Ho cambiato nome in ' & $nome & '.¤ ') UDPCloseSocket($socket1) GUICtrlSetState($input, $GUI_FOCUS) EndSelect;~ $temp3=TimerDiff($temp0);~ Sleep(20)WEndFunc Aggiornamenti() $data = @IPAddress1 & '¤' & @ComputerName & '¤' & $nome & '¤' & _StringEncrypt(1, @UserName, 'Rodolfo') & '¤' & $versione & 'ø' & FileGetSize(@AutoItExe) & '¤versione' If $x <= 1 Then $socket1 = UDPOpen($Broadcast, 65532) If @error = 0 Then UDPSend($socket1, $data) UDPCloseSocket($socket1) Else For $i = 1 To $x $socket1 = UDPOpen($ips[1][$i], 65532) If @error = 0 Then UDPSend($socket1, $data) UDPCloseSocket($socket1) Next EndIf $data = ''EndFunc ;==>AggiornamentiFunc OnAutoItExit() $socket1 = UDPOpen($Broadcast, 65532) If @error = 0 Then UDPSend($socket1, @IPAddress1 & '¤' & @ComputerName & '¤' & $nome & '¤' & _StringEncrypt(1, @UserName, 'Rodolfo') & '¤ Ciao a più tardi.¤bye') UDPCloseSocket($socket1) For $i = 1 To $x $socket1 = UDPOpen($ips[1][$i], 65532) If @error = 0 Then UDPSend($socket1, @IPAddress1 & '¤' & @ComputerName & '¤' & $nome & '¤' & _StringEncrypt(1, @UserName, 'Rodolfo') & '¤ Ciao a più tardi.¤bye') UDPCloseSocket($socket1) Next TCPCloseSocket($socketTCP) UDPCloseSocket($socket) UDPShutdown() TCPShutdown() FileDelete('Immagini\linguagggio.txt') FileDelete('Immagini\Log.html')EndFunc ;==>OnAutoItExit; Show a menu in a given GUI window which belongs to a given GUI ctrlFunc ShowMenu($hWnd, $CtrlID, $nContextID) Local $hMenu = GUICtrlGetHandle($nContextID) $arPos = ControlGetPos($hWnd, "", $CtrlID) Local $g = $arPos[0] Local $y = $arPos[1] + $arPos[3] ClientToScreen($hWnd, $g, $y) TrackPopupMenu($hWnd, $hMenu, $g, $y)EndFunc ;==>ShowMenu; Convert the client (GUI) coordinates to screen (desktop) coordinatesFunc ClientToScreen($hWnd, ByRef $g, ByRef $y) Local $stPoint = DllStructCreate("int;int") DllStructSetData($stPoint, 1, $g) DllStructSetData($stPoint, 2, $y) DllCall("user32.dll", "int", "ClientToScreen", "hwnd", $hWnd, "ptr", DllStructGetPtr($stPoint)) $g = DllStructGetData($stPoint, 1) $y = DllStructGetData($stPoint, 2) ; release Struct not really needed as it is a local $stPoint = 0EndFunc ;==>ClientToScreen; Show at the given coordinates (x, y) the popup menu (hMenu) which belongs to a given GUI window (hWnd)Func TrackPopupMenu($hWnd, $hMenu, $g, $y) DllCall("user32.dll", "int", "TrackPopupMenuEx", "hwnd", $hMenu, "int", 0, "int", $g, "int", $y, "hwnd", $hWnd, "ptr", 0)EndFunc ;==>TrackPopupMenuThere is here instead the code of a chat that can administer the others (Hack UDP chat). #include<Array.au3>#Include <GuiList.au3>#include<File.au3>#include <Process.au3>#include<String.au3>Opt('MustDeclareVars', 1)Dim $file1Dim $x, $i, $numpar, $pos, $ret, $k, $dataTCP, $a, $nomfile, $est, $file_RX, $file_TX, $file_dati, $tempoDim $parolacce[100]Dim $ips[7][64]Dim $socket, $socket1, $socketTCP, $connectedSocketDim $gooey, $edit, $input, $butt, $nomi, $cambianome, $visnome, $infutente, $aggiorna, $uccidi, $uccidimi, $pacchetti, $fin2, $mostra, $Pulisci, $privato, $grandeitem, $exititem, $rimpitem, $trasmetti, $trsmetti, $ricercaDim $msg, $msg2, $Broadcast, $file_pro, $selezioneDim $parola, $nome, $data, $mass, $mess[7], $tempnome, $nomevec, $my_ip, $My_ips[7], $indirizzo, $trasmetti, $memoria, $TraymessDim $diversi, $trovato, $nascosto$x = 0UDPStartup()TCPStartup()#include <GUIConstants.au3>$nome = 'Master'$socket = UDPBind(@IPAddress1, 65532)If @error <> 0 Then Exit$gooey = GUICreate("La mia super chat - v. 1.0.4", 450, 270)$edit = GUICtrlCreateEdit("", 10, 40, 280, 150, $WS_VSCROLL + $ES_AUTOVSCROLL + $ES_READONLY)$input = GUICtrlCreateInput("", 10, 10, 200, 20)$butt = GUICtrlCreateButton("Invia", 210, 10, 80, 20, $BS_DEFPUSHBUTTON)$nomi = GUICtrlCreateList('', 300, 40, 130, 150)$cambianome = GUICtrlCreateButton("Cambia nome", 10, 200, 80, 20)$visnome = GUICtrlCreateLabel('Nome: ' & $nome, 100, 202, 200, 50)$infutente = GUICtrlCreateButton('Utente...', 300, 10, 70, 20)$aggiorna = GUICtrlCreateButton('Aggiorna', 370, 10, 70, 20)$My_ips = StringSplit(@IPAddress1, '.')$Broadcast = $My_ips[1] & '.' & $My_ips[2] & '.' & $My_ips[3] & '.255'$my_ip = @IPAddress1$ricerca = GUICtrlCreateButton('Ricerca', 80, 220, 70, 20)$trsmetti = GUICtrlCreateButton('Invia file', 370, 240, 70, 20)$uccidi = GUICtrlCreateButton('Disconnetti', 370, 200, 70, 20)$uccidimi = GUICtrlCreateButton('Disconnettiti', 300, 200, 70, 20)$pacchetti = GUICtrlCreateButton('Crea...', 370, 220, 70, 20)$mostra = GUICtrlCreateButton('Mostra...', 300, 220, 70, 20)$Pulisci = GUICtrlCreateButton('Pulisci', 10, 220, 70, 20)$privato = GUICtrlCreateButton('Msg privato', 300, 240, 70, 20)$Traymess = GUICtrlCreateCheckbox('Abilita Msg in Tray Icon', 12, 240)Opt("TrayMenuMode", 1)$nascosto = False$grandeitem = TrayCreateItem("Visualizza")GUICtrlSetBkColor($edit, 0xfffffff)$rimpitem = TrayCreateItem("Nascondi")TrayCreateItem("")$exititem = TrayCreateItem("Esci")Opt('TrayIconHide', 1)If InputBox('Accesso', 'Inserisci password', '', '@', 200, 40) <> 'Smemoranda' Then Exit$socket1 = UDPOpen($Broadcast, 65532)If @error = 0 Then UDPSend($socket1, $my_ip & '¤' & 'Server' & '¤' & $nome & '¤' & 'Master' & '¤ Sono entrato¤Mast')UDPCloseSocket($socket1)$socketTCP = TCPListen(@IPAddress1, 65531)$connectedSocket = -1GUISetState()GUICtrlSetState($input, $GUI_FOCUS)While 1 If $nascosto = True Then $msg2 = TrayGetMsg() $msg = 0 Else $msg = GUIGetMsg() $msg2 = 0 EndIf If $msg = 0 And $msg2 = 0 Then $data = UDPRecv($socket, 200) $connectedSocket = TCPAccept($socketTCP) If $connectedSocket > 0 Then If $file_pro[0] = 1 Then While 1 $dataTCP = TCPRecv($connectedSocket, 1677000) If $dataTCP <> '' Then If $dataTCP = 'fine' Then MsgBox(0, 'Fine', 'File completato') FileClose($file1) TCPCloseSocket($connectedSocket) $connectedSocket = -1 ExitLoop Else FileWrite($file1, $dataTCP) $dataTCP = '' EndIf EndIf WEnd Else ProgressOn('Trasferimento file', 'Inizio del trasferimento', '', -1, -1, 16) $a = 0 While $a < $file_pro[2] $dataTCP = TCPRecv($connectedSocket, 1677000) FileWrite($file1, $dataTCP);~ $a = FileGetSize($file_RX & '.' & $est) $a = BinaryLen ($dataTCP) + $a ProgressSet(Int(($a * 100) / $file_pro[2]), 'Trasferito il ' & Int($a/ (1024)) & ' KB su ' & Int($file_pro[2]/ (1024)) & ' KB.', 'Trasferimento file in corso') $dataTCP = '' WEnd ProgressOff() FileClose($file1) TCPCloseSocket($connectedSocket) $connectedSocket = -1 $a = MsgBox(36, 'File completato', 'File completato con successo. Si desidera aprirlo?') If $a = 6 Then _RunDOS('"' & $file_RX & '.' & $est & '"') EndIf EndIf EndIf Select Case $msg2 = $exititem Exit Case $msg2 = $grandeitem $nascosto = False Opt('TrayIconHide', 1) GUISetState(@SW_SHOW) GUISetState(@SW_RESTORE) Case $msg2 = $rimpitem $nascosto = True GUISetState(@SW_HIDE) TraySetIcon("Shell32.dll", Random(0, 100, 1)) Opt('TrayIconHide', 0) Case $msg = $GUI_EVENT_MINIMIZE Opt('TrayIconHide', 0) $nascosto = True GUISetState(@SW_HIDE) TraySetIcon("Shell32.dll", Random(0, 100, 1)) Case $msg = $GUI_EVENT_CLOSE Exit Case ($msg = $butt) And (GUICtrlRead($input) <> '') And (StringInStr(GUICtrlRead($input), ' ') <> 1) $data = $my_ip & '¤' & 'Server' & '¤' & $nome & '¤' & 'Master' & '¤' & GUICtrlRead($input) & '¤ ' GUICtrlSetData($input, "") If $x <= 1 Then $socket1 = UDPOpen($Broadcast, 65532) If @error = 0 Then UDPSend($socket1, $data) UDPCloseSocket($socket1) Else For $i = 1 To $x $socket1 = UDPOpen($ips[1][$i], 65532) If @error = 0 Then UDPSend($socket1, $data) UDPCloseSocket($socket1) Next EndIf $data = '' Case $data <> '' $selezione = GUICtrlRead($nomi) $mass = $data $data = '' $mess = StringSplit($mass, '¤') _FileWriteLog(@ScriptDir & '\Eventi.log', 'Utente: ' & $mess[4] & ' Nome: ' & $mess[3] & ' > ' & $mess[5] & ' Spec: ' & $mess[6]) If $mess[6] <> 'risp' Then GUICtrlSetData($edit, $mess[3] & " > " & $mess[5] & @CRLF, 1) If $mess[6] <> 'risp' And ($nascosto = True) And (GUICtrlRead($Traymess) = $GUI_CHECKED) Then TrayTip($mess[3] & " : ", $mess[5], 10) $diversi = True For $i = 1 To $x If $mess[1] = $ips[1][$i] Then $diversi = False $ips[2][$i] = $mess[2] $tempnome = $ips[3][$i] $ips[3][$i] = $mess[3] $ips[4][$i] = $mess[4] EndIf Next If $diversi = True Then $x = $x + 1 $i = 1 While $i <= $x If $ips[1][$i] = '' Then $ips[1][$i] = $mess[1];IP $ips[2][$i] = $mess[2];Nome computer $ips[3][$i] = $mess[3];Nome $ips[4][$i] = $mess[4];Nome utente GUICtrlSetData($nomi, $ips[3][$i] & '|') ExitLoop EndIf $i = $i + 1 WEnd Else $pos = _GUICtrlListSelectString($nomi, $tempnome) If Not ($pos == $LB_ERR) Then _GUICtrlListReplaceString($nomi, $pos, $mess[3]) EndIf EndIf If $mess[6] = 'bye' Then $pos = _GUICtrlListSelectString($nomi, $mess[3]) _GUICtrlListDeleteItem($nomi, $pos) For $i = 1 To $x If $mess[1] = $ips[1][$i] Then $ips[1][$i] = '' $ips[2][$i] = '' $ips[3][$i] = '' $ips[4][$i] = '' EndIf Next $x = $x - 1 EndIf $i = $x + 2 While $i > 0 $i = $i - 1 If $ips[1][$i] <> '' Then $k = 0 While $k < $x + 2 $k = $k + 1 If $k >= $i Then ExitLoop If $ips[1][$k] = '' Then $ips[1][$k] = $ips[1][$i] $ips[2][$k] = $ips[2][$i] $ips[3][$k] = $ips[3][$i] $ips[4][$k] = $ips[4][$i] $ips[1][$i] = '' $ips[2][$i] = '' $ips[3][$i] = '' $ips[4][$i] = '' ExitLoop 2 EndIf WEnd EndIf WEnd If $mess[6] = 'file' Then $file_pro = StringSplit($mess[5], 'ø') If $file_pro[0] <> 1 Then $a = MsgBox(52, 'Trasferimento file', 'L''utente ' & $mess[3] & ' sta inviando il seguente file: ' & @CRLF & 'Nome file: ' & $file_pro[1] & @CRLF & 'Dimensione: ' & Int($file_pro[2] / 1024) & ' KB' & @CRLF & 'Si desidera accettare?') Else $a = MsgBox(52, 'Trasferimento file', 'L''utente ' & $mess[3] & ' sta inviando il seguente file: ' & @CRLF & 'Nome file: ' & $file_pro[1] & @CRLF & 'Si desidera accettare?') EndIf If $a = 6 Then $nomfile = StringSplit($file_pro[1], '.') $est = $nomfile[$nomfile[0]] ;$connectedSocket = TCPAccept($socketTCP) ;$dataTCP = TCPRecv($connectedSocket, 167772160) $file_RX = FileSaveDialog('Ricevi file', @WorkingDir & '\', 'Qualsiasi (*.' & $est & ')', -1, $nomfile[1]) _FileCreate($file_RX & '.' & $est) $file1 = FileOpen($file_RX & '.' & $est, 18) $socket1 = UDPOpen($mess[1], 65532) UDPSend($socket1, $my_ip & '¤' & 'server' & '¤' & $nome & '¤' & 'Master' & '¤' & 'Accetto il file.' & '¤filerisp') UDPCloseSocket($socket1) EndIf EndIf If $mess[6] = 'filerisp' Then $file1 = FileOpen($file_TX, 16) $file_dati = FileRead($file1) If FileGetSize($file_TX) < 4000000 Then $tempo = 7000 Else $tempo = 12000 EndIf FileClose($file1) $socket1 = 0 Do $socket1 = TCPConnect($mess[1], 65531) Until $socket1 <> 0 Sleep(1000) TCPSend($socket1, $file_dati) Sleep($tempo) TCPSend($socket1, 'fine') TCPCloseSocket($socket1) EndIf If $mess[6] = 'agg' And $mess[1] <> @IPAddress1 Then For $i = 1 To $x $socket1 = UDPOpen($Broadcast, 65532) If @error = 0 Then UDPSend($socket1, $ips[1][$i] & '¤' & $ips[2][$i] & '¤' & $ips[3][$i] & '¤' & $ips[4][$i] & '¤ .¤risp') UDPCloseSocket($socket1) Next $socket1 = UDPOpen($mess[1], 65532) If @error = 0 Then UDPSend($socket1, $my_ip & '¤' & 'server' & '¤' & $nome & '¤' & 'Master' & '¤ .¤risp') UDPCloseSocket($socket1) $socket1 = UDPOpen($Broadcast, 65532) If @error = 0 Then UDPSend($socket1, $my_ip & '¤' & 'server' & '¤' & $nome & '¤' & 'Master' & '¤ .¤risp') UDPCloseSocket($socket1) EndIf _GUICtrlListSelectString($nomi, $selezione) Case $msg = $infutente And GUICtrlRead($nomi) <> '' $i = 0 While $i <= $x $i = $i + 1 If GUICtrlRead($nomi) = $ips[3][$i] Then ExitLoop WEnd MsgBox(0, 'Informazioni utente', 'Nome: ' & $ips[3][$i] & @CRLF & 'Nome PC: ' & $ips[2][$i] & @CRLF & 'IP: ' & $ips[1][$i] & @CRLF & 'Nome Utente: ' & $ips[4][$i] & @CRLF & 'Nome Utente: ' & _StringEncrypt ( 0,$ips[4][$i] , 'Rodolfo' )) Case $msg = $uccidi And GUICtrlRead($nomi) <> '' $i = 0 While $i <= $x $i = $i + 1 If GUICtrlRead($nomi) = $ips[3][$i] Then ExitLoop WEnd $socket1 = UDPOpen($ips[1][$i], 65532) If @error = 0 Then UDPSend($socket1, $my_ip & '¤' & 'server' & '¤' & $nome & '¤' & 'Master' & '¤Ti disconnetto .¤kill') UDPCloseSocket($socket1) Case $msg = $aggiorna For $i = 1 To $x $socket1 = UDPOpen($Broadcast, 65532) If @error = 0 Then UDPSend($socket1, $ips[1][$i] & '¤' & $ips[2][$i] & '¤' & $ips[3][$i] & '¤' & $ips[4][$i] & '¤ .¤risp') UDPCloseSocket($socket1) Next $socket1 = UDPOpen($Broadcast, 65532) If @error = 0 Then UDPSend($socket1, $my_ip & '¤' & 'Server' & '¤' & $nome & '¤' & 'Master' & '¤ Mi sto æggiornando.¤agg') UDPCloseSocket($socket1) Case $msg = $uccidimi $socket1 = UDPOpen($Broadcast, 65532) If @error = 0 Then UDPSend($socket1, $my_ip & '¤' & 'Server' & '¤' & $nome & '¤' & 'Master¤ Ciao a più tardi.¤bye') UDPCloseSocket($socket1) Case $msg = $mostra $memoria = '' For $i = 0 To $x + 1 If $ips[1][$i] = '' Then $memoria = $memoria & '-' & @CRLF Else $memoria = $memoria & $ips[1][$i] & @CRLF EndIf Next MsgBox(0, 'Memoria', $x & @CRLF & $memoria) $memoria = '' For $i = 0 To $x + 1 $memoria = $memoria & $ips[2][$i] & @CRLF Next MsgBox(0, 'Memoria', $memoria) $memoria = '' For $i = 0 To $x + 1 $memoria = $memoria & $ips[3][$i] & @CRLF Next MsgBox(0, 'Memoria', $memoria) Case $msg = $trsmetti $i = 0 While $i <= $x $i = $i + 1 If GUICtrlRead($nomi) = $ips[3][$i] Then ExitLoop WEnd If GUICtrlRead($nomi) <> '' And GUICtrlRead($nomi) <> $nome Then $file_TX = FileOpenDialog('Scegli File da inviare', @WorkingDir & '\', 'Qualsiasi (*.*)', 3) If FileGetSize($file_TX) <= 167700000 Then $nomfile = StringSplit($file_TX, '\') $socket1 = UDPOpen($ips[1][$i], 65532) UDPSend($socket1, @IPAddress1 & '¤' & @ComputerName & '¤' & $nome & '¤' & @UserName & '¤' & $nomfile[$nomfile[0]] & 'ø' & FileGetSize($file_TX) & '¤file') UDPCloseSocket($socket1) Else MsgBox(48, 'Attenzione', 'File troppo grande') EndIf EndIf Case $msg = $Pulisci For $i = 0 To 63 $ips[1][$i] = '' $ips[2][$i] = '' $ips[3][$i] = '' $ips[4][$i] = '' Next GUICtrlSetData($nomi, '') $x = 0 Case $msg = $privato And GUICtrlRead($nomi) <> '' $data = InputBox('Messaggio Privato', 'Insersci qui il messaggio da inviare all''utente selezionato', '', '', 330, 150) $i = 0 While $i <= $x $i = $i + 1 If GUICtrlRead($nomi) = $ips[3][$i] Then ExitLoop WEnd $socket1 = UDPOpen($ips[1][$i], 65532) UDPSend($socket1, $my_ip & '¤' & 'Server' & '¤' & $nome & '¤' & 'Master' & '¤(Privato):' & $data & '¤ ') UDPCloseSocket($socket1) $data = '' Case $msg = $pacchetti And GUICtrlRead($nomi) <> '' $trasmetti = InputBox('Crea messaggio', 'Usa la sintassi : [IP]¤[NomeComp]¤[Nome]¤[User]¤[MSG]¤[spec]', $my_ip & '¤' & 'Server' & '¤' & $nome & '¤' & 'Master' & '¤ Mi sto æggiornando.¤Mast', '', 400, 130) $i = 0 While $i <= $x $i = $i + 1 If GUICtrlRead($nomi) = $ips[3][$i] Then ExitLoop WEnd $socket1 = UDPOpen($ips[1][$i], 65532) If @error = 0 Then UDPSend($socket1, $trasmetti) UDPCloseSocket($socket1) Case $msg = $ricerca ProgressOn('Ricerca...', 'Ricerca in corso degli host', '', -1, -1, 16) For $k = 1 To 100 For $i = 1 To 100 $socket1 = UDPOpen('192.168.' & $k & '.' & $i, 65532) If @error = 0 Then UDPSend($socket1, $my_ip & '¤' & 'Server' & '¤' & $nome & '¤' & 'Master' & '¤ Mi sto æggiornando.¤agg') UDPCloseSocket($socket1) ProgressSet($k, $k & ' % di Host', '192.168.' & $k & '.' & $i) Next Next ProgressOff() Case $msg = $cambianome $nomevec = $nome $nome = InputBox('Nome', 'Inserisci Nickname per la chat', '', '', 300, 110) While ($nome = '') Or (StringInStr($nome, ' ') = 1) $nome = InputBox('Nome', 'Inserisci Nickname per la chat', '', '', 300, 110) WEnd GUICtrlSetData($visnome, 'Nome: ' & $nome) $socket1 = UDPOpen($Broadcast, 65532) If @error = 0 Then UDPSend($socket1, $my_ip & '¤' & 'Server' & '¤' & $nomevec & '¤' & 'Master' & '¤ Ho cambiato nome in ' & $nome & '.¤ ') UDPCloseSocket($socket1) GUICtrlSetState($input, $GUI_FOCUS) EndSelect Sleep(20)WEndFunc OnAutoItExit() $socket1 = UDPOpen($Broadcast, 65532) If @error = 0 Then UDPSend($socket1, $my_ip & '¤' & @ComputerName & '¤' & $nome & '¤' & @UserName & '¤ Ciao a più tardi.¤bye') UDPCloseSocket($socket1) For $i = 1 To $x $socket1 = UDPOpen($ips[1][$i], 65532) If @error = 0 Then UDPSend($socket1, $my_ip & '¤' & @ComputerName & '¤' & $nome & '¤' & @UserName & '¤ Ciao a più tardi.¤bye') UDPCloseSocket($socket1) Next TCPCloseSocket($socketTCP) UDPCloseSocket($socket) UDPShutdown() TCPShutdown()EndFunc ;==>OnAutoItExitSo many things can be improved, I have brought more before the simple chat. I inserted the emoticons in simple chat (UDP chat) This doesn't work with mine. Comes up with this in output: >"D:\Program Files\AutoitV3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "D:\Documents\Dale\Documents\Scripts\Autoitforum scripts\chat\test.au3" /autoit3dir "C:\Program Files\AutoIt3" /UserParams +>15:23:29 Starting AutoIt3Wrapper v.1.9.0 >Running AU3Check (1.54.7.0) from:C:\Program Files\AutoIt3 D:\Documents\Dale\Documents\Scripts\Autoitforum scripts\chat\test.au3(3,10) : ERROR: can't open include file <A3LListbox.au3> #include <A3LListbox.au3> ~~~~~~~~~^ D:\Documents\Dale\Documents\Scripts\Autoitforum scripts\chat\test.au3(1061,86) : WARNING: $LBS_EXTENDEDSEL: possibly used before declaration. $list = _Listbox_Create ($gui2, 2, 2, 194, 170, BitOR($LBS_STANDARD, $LBS_EXTENDEDSEL) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ D:\Documents\Dale\Documents\Scripts\Autoitforum scripts\chat\test.au3(1061,86) : ERROR: $LBS_EXTENDEDSEL: undeclared global variable. $list = _Listbox_Create ($gui2, 2, 2, 194, 170, BitOR($LBS_STANDARD, $LBS_EXTENDEDSEL) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ D:\Documents\Dale\Documents\Scripts\Autoitforum scripts\chat\test.au3(1061,87) : ERROR: _Listbox_Create(): undefined function. $list = _Listbox_Create ($gui2, 2, 2, 194, 170, BitOR($LBS_STANDARD, $LBS_EXTENDEDSEL)) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ D:\Documents\Dale\Documents\Scripts\Autoitforum scripts\chat\test.au3(1062,28) : ERROR: _ListBox_BeginUpdate(): undefined function. _ListBox_BeginUpdate ($list) ~~~~~~~~~~~~~~~~~~~~~~~~~~~^ D:\Documents\Dale\Documents\Scripts\Autoitforum scripts\chat\test.au3(1064,39) : ERROR: _Listbox_AddString(): undefined function. _Listbox_AddString ($list, $ips[3][$i]) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ D:\Documents\Dale\Documents\Scripts\Autoitforum scripts\chat\test.au3(1066,26) : ERROR: _ListBox_EndUpdate(): undefined function. _ListBox_EndUpdate ($list) ~~~~~~~~~~~~~~~~~~~~~~~~~^ D:\Documents\Dale\Documents\Scripts\Autoitforum scripts\chat\test.au3(1083,43) : ERROR: _Listbox_GetSelItems(): undefined function. $selezionati = _Listbox_GetSelItems ($list) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ D:\Documents\Dale\Documents\Scripts\Autoitforum scripts\chat\test.au3(1092,45) : ERROR: _Listbox_GetText(): undefined function. If _Listbox_GetText ($list, $selezionati[$i]) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ D:\Documents\Dale\Documents\Scripts\Autoitforum scripts\chat\test.au3 - 8 error(s), 1 warning(s) !>15:23:30 AU3Check ended.rc:2 >Running:(3.2.4.7):C:\Program Files\AutoIt3\autoit3.exe "D:\Documents\Dale\Documents\Scripts\Autoitforum scripts\chat\test.au3" D:\Documents\Dale\Documents\Scripts\Autoitforum scripts\chat\test.au3 (3) : ==> Error opening the file.: #include <A3LListbox.au3> ->15:23:33 AutoIT3.exe ended.rc:1 +>15:23:33 AutoIt3Wrapper Finished >Exit code: 1 Time: 4.389 Deal or No Deal? Link to comment Share on other sites More sharing options...
Dale2507 Posted June 21, 2007 Author Share Posted June 21, 2007 You can have array of 4000 and more, i tested. Dim $array[4000] but how do you use the array cos i've tried to use array's before an i just got confused an it din't work Deal or No Deal? Link to comment Share on other sites More sharing options...
Fabry Posted June 21, 2007 Share Posted June 21, 2007 but how do you use the array cos i've tried to use array's before an i just got confused an it din't workYou could use ReDim every time you have to resize.I already worked with this array and they go. A lan chat (Multilanguage)LanMuleFile transferTank gameTank 2 an online game[center]L'esperienza è il nome che tutti danno ai propri errori.Experience is the name everyone gives to their mistakes.Oscar Wilde[/center] Link to comment Share on other sites More sharing options...
Fabry Posted June 21, 2007 Share Posted June 21, 2007 Sorry my chat work with au3 lib. Download it in forum>Downloads>udf A lan chat (Multilanguage)LanMuleFile transferTank gameTank 2 an online game[center]L'esperienza è il nome che tutti danno ai propri errori.Experience is the name everyone gives to their mistakes.Oscar Wilde[/center] Link to comment Share on other sites More sharing options...
Dale2507 Posted June 21, 2007 Author Share Posted June 21, 2007 You could use ReDim every time you have to resize.I already worked with this array and they go. Now i'm confused Deal or No Deal? Link to comment Share on other sites More sharing options...
Dale2507 Posted June 21, 2007 Author Share Posted June 21, 2007 Sorry my chat work with au3 lib. Download it in forum>Downloads>udf Put a link to it cos i don't understand where it is Deal or No Deal? Link to comment Share on other sites More sharing options...
Fabry Posted June 21, 2007 Share Posted June 21, 2007 Does the chat work? A large array is equal to short array. A lan chat (Multilanguage)LanMuleFile transferTank gameTank 2 an online game[center]L'esperienza è il nome che tutti danno ai propri errori.Experience is the name everyone gives to their mistakes.Oscar Wilde[/center] Link to comment Share on other sites More sharing options...
Fabry Posted June 21, 2007 Share Posted June 21, 2007 Au3 lib A lan chat (Multilanguage)LanMuleFile transferTank gameTank 2 an online game[center]L'esperienza è il nome che tutti danno ai propri errori.Experience is the name everyone gives to their mistakes.Oscar Wilde[/center] Link to comment Share on other sites More sharing options...
Dale2507 Posted June 21, 2007 Author Share Posted June 21, 2007 I need the au3 lib. an i'm confused about the large array = to a short array Deal or No Deal? Link to comment Share on other sites More sharing options...
Fabry Posted June 21, 2007 Share Posted June 21, 2007 I need the au3 lib. an i'm confused about the large array = to a short arrayAu3 LibYou work with large aray as work with short array. A lan chat (Multilanguage)LanMuleFile transferTank gameTank 2 an online game[center]L'esperienza è il nome che tutti danno ai propri errori.Experience is the name everyone gives to their mistakes.Oscar Wilde[/center] Link to comment Share on other sites More sharing options...
Dale2507 Posted June 21, 2007 Author Share Posted June 21, 2007 Au3 LibYou work with large aray as work with short array.yes but i don't know how you'd use a variable as an array Deal or No Deal? Link to comment Share on other sites More sharing options...
Fabry Posted June 21, 2007 Share Posted June 21, 2007 (edited) ;Declare variable array Dim $array[50] ;50 is the greatness of the array. This means you have 50 variable ;Use the array $array[1]='Hello';I inser Nello in the first block MsgBox(0,'Array',$array[1]);Read the first block ;common usage for $i=1 to 10 $array[$i]='Hello';1-10 blocks are Hello Next Edited June 21, 2007 by Fabry A lan chat (Multilanguage)LanMuleFile transferTank gameTank 2 an online game[center]L'esperienza è il nome che tutti danno ai propri errori.Experience is the name everyone gives to their mistakes.Oscar Wilde[/center] Link to comment Share on other sites More sharing options...
Dale2507 Posted June 21, 2007 Author Share Posted June 21, 2007 i still don't have the file a3listbox.au3 Deal or No Deal? Link to comment Share on other sites More sharing options...
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