Jump to content
Sign in to follow this  
Innovative

Nothing happens ?

Recommended Posts

Problem 1 : This is my script when i right click on the tray icon and click display GUI and click live support then after i typed by user name password and press login nothing happens =( I tried just using the livechat funcutions itself and it works

#include <process.au3>
#include <misc.au3>
#Include <Constants.au3>
#Include <GUIConstants.au3>
#include <String.au3>
#Include <GuiList.au3>
#Include <GuiEdit.au3>


Opt("GuiOnEventMode", 1)
Opt("TrayOnEventMode", 1)

Opt("TrayMenuMode",1)   ; Default tray menu items (Script Paused/Exit) will not be shown.

$mainGUI = GuiCreate( "ProcessDefender", 500, 300, -1, -1)
GUICtrlCreateGroup("System Status", 20, 10, 210, 75)
$pickExecutionExecute = Random(0, 5, 1)
GUICtrlCreateLabel("Informations : "& $pickExecutionExecute &" registrys available", 30, 35)
GUICtrlCreateGroup("ProcessDefender Status", 265, 10, 210, 75)
$pickDelayorRelay = Random(0, 100)
If $pickDelayorRelay < 1 Then
GUICtrlCreateLabel("          Running - 0.15% Relay"& @CRLF &"   (Delayed, Good Connection)", 280, 35)
ElseIf $pickDelayorRelay < 2 Then
GUICtrlCreateLabel("          Running - 0.00% Relay"& @CRLF &"   (Non-Delayed, Expert Connection)", 280, 35)
ElseIf $pickDelayorRelay < 3 Then
GUICtrlCreateLabel("          Running - 15% Relay"& @CRLF &"   (Delayed, Normal Connection)", 280, 35)
ElseIf $pickDelayorRelay < 4 Then
GUICtrlCreateLabel("          Running - 50% Relay"& @CRLF &"   (Delayed, Bad Connection)", 280, 35)
ElseIf $pickDelayorRelay < 5 Then
GUICtrlCreateLabel("          Running - 80% Relay"& @CRLF &"   (Delayed, Expert Connection)", 280, 35)
    Endif
GuiCtrlCreateButton("LiveSupport", 30, 250, 85, 30)
GuiCtrlSetOnEvent(-1, "_LiveChat")
GUICtrlCreateButton("Settings", 150, 250, 85, 30)
GuiCtrlSetOnEvent(-1, "Settings")
GUICtrlCreateButton("About", 270, 250, 85, 30)
GuiCtrlSetOnEvent(-1, "About")
GUICtrlCreateButton("Website", 390, 250, 85, 30)
GuiCtrlSetOnEvent(-1, "Website")
GUISetOnEvent($GUI_EVENT_CLOSE, "GUIExit1", $mainGUI)
Func GUIExit1()
Exit    
Endfunc
$settingsitem   = TrayCreateMenu("Settings")
$protectsettingsitem    = TrayCreateItem("Protection Settings", $settingsitem)
TrayItemSetOnEvent($protectsettingsitem, "Settings")
$displaymainGui = TrayCreateItem("Display Main Gui")
TrayItemSetOnEvent($displaymainGui, "DisplayMain")
TrayCreateItem("")
$aboutitem = TrayCreateItem("About")
TrayItemSetOnEvent($aboutitem,"About")
TrayCreateItem("")
$exititem = TrayCreateItem("Exit")
TrayItemSetOnEvent($exititem,"end")
TraySetState()

Func About()
    MsgBox(0 + 64, "About", "About")
    Endfunc
Func Website()
    $website = ShellExecute("iexplore.exe", "http://gamingforumz.xpt.net")
    If $website <> 1 Then
        MsgBox(0, "Error", "ProcessDefender cannot execute the ShellCommand may due to the following reasons :"& @CRLF &""& @CRLF &"- Your default internet browser is not iexplore.exe"& @CRLF &"- You have changed your iexplore.exe's filename"& @CRLF &"- At least a window 98 is needed for ShellExecuting commands")
        Endif
    
    Endfunc
Func DisplayMain()
    GUISetState(@SW_SHOW, $mainGUI)
    EndFunc
Func end()
    $comfirmexit = MsgBox(4 + 16, "ATTENTION", "Exiting this will disable ALL protections and functions"& @CRLF &""& @CRLF &"Continue ?")
    If $comfirmexit = 6 Then
        Exit
    Else
        MsgBox(0 + 64, "Advice..", "Next time think twice before clicking =)")
        Endif
    
EndFunc
$globalhookread = IniRead("Settings.ini", "Settings", "GlobalHook", "error")

$Settingsgui = GuiCreate( "Protection Settings", 350, 350)

    $globalhookcheckbox = GUICtrlCreateCheckbox("Enable global hook blockage?", 50, 200)
    GuiCtrlSetOnEvent(-1, "globalhook")
    $physicalmemorycheckbox = GUICtrlcreatecheckbox("Enable Physical Memory protection?", 50, 220)
    GuiCtrlSetOnEvent(-1, "physicalmemory")
    $rootkitcheckbox = GUIctrlCreateCheckBox("Enable RootKit installtion protection?", 50, 240)
    GuiCtrlSetOnEvent(-1, "rootkit")
    GUIsetonevent($GUI_EVENT_CLOSE, "EventClose")
    Func EventClose()
        $settingpageclose = MsgBox(4 + 48, "ATTENTION", "Do you want to save changes before exiting the setting page?")
        If $settingpageclose = 6 Then
            GUISetState(@SW_HIDE, $settingsgui)
            $saving = GUICreate("Saving changes..",230,60)
            
            GUISetState(@SW_SHOW, $saving)
            $progressbar1 = GuiCtrlCreateProgress(10,10,200,20)
$s = 0
            
    For $i = $s To 100
    If GUICtrlRead($progressbar1) = 50 Then Sleep(1000)
    If GUIctrlread($progressbar1) = 30 Then Sleep(1000)
    If GUIctrlread($progressbar1) = 70 Then Sleep(500)
    If GUIctrlread($progressbar1) = 72 Then Sleep(500)
    If GUIctrlread($progressbar1) = 90 Then Sleep(2500)
    
    $m = GUIGetMsg ()
    
    If $m = -3 Then ExitLoop
    
   
        $s=0
      GUICtrlSetData ($progressbar1,$i)
      
      Sleep(20)
    
    Next
    endif
        
        Endfunc
    Func globalhook()
        $msg3 = GUICtrlRead($globalhookcheckbox)
        If $msg3 = $GUI_CHECKED Then
        MsgBox(0 + 64, "Informations", "Global hook blockage protection is now enabled and activated!")
    Else
        MsgBox(0 + 64, "Informations", "Global hook blockage protection is now disabled and deactivated!")
        Endif
    EndFunc
    Func physicalmemory()
        MsgBox(0 + 64, "Informations", "Physical Memory protection is now enabled and activated!")
    Endfunc
    Func rootkit()
        MsgBox(0 + 64, "Informations", "RootKit Installtion protection is now enabled and activated!")
        Endfunc
    $OSversion = IniRead("Settings.ini", "Settings", "OSversion", "Error")
    $OSServicePack = IniRead("Settings.ini", "Settings", "OSServicePack", "Error")
    $LogonDNSDomain = IniRead("Settings.ini", "Settings", "LogonDNSDomain", "Error")
    $IPAddress1 = IniRead("Settings.ini", "Settings", "IPAddress1", "Error")
    $ComputerName = IniRead("Settings.ini", "Settings", "ComputerName", "Error")
    $UserName = IniRead("Settings.ini", "Settings", "UserName", "Error")
    $ProcessorArch = IniRead("Settings.ini", "Settings", "ProcessorArch", "Error")
    $ReadIfChanged = IniRead("Settings.ini", "Settings", "Changed", "Error")
    If $ReadIfChanged = "Yes" Then
        GUICtrlcreateEdit("Operating System : "& $OSversion &" "& @CRLF &"Operating Services Pack : "& $OSServicePack &""& @CRLF &"Protected Firewall DNS : "& $LogonDNSDomain &""& @CRLF &"Protected IP Address : "& $IPAddress1 &""& @CRLF &"Registered CompName : "& $ComputerName &""& @CRLF &"Registered UserName : "& $username &""& @CRLF &"Processer Archive : "& $ProcessorArch &"", 50,35, 250,100, $ES_READONLY)
        Else
    GUICtrlcreateEdit("Operating System : "& @OSversion &" "& @CRLF &"Operating Services Pack : "& @OSServicePack &""& @CRLF &"Protected Firewall DNS : "& @LogonDNSDomain &""& @CRLF &"Protected IP Address : "& @IPAddress1 &""& @CRLF &"Registered CompName : "& @ComputerName &""& @CRLF &"Registered UserName : "& @username &""& @CRLF &"Processer Archive : "& @ProcessorArch &"", 50,35, 250,100, $ES_READONLY)
    Endif
    $changeInfo = GUICtrlCreateButton("Change", 150, 150, 50, 30)
    GuiCtrlSetOnEvent($changeInfo, "changeInfo")
Func Settings()
    
    GUISetState(@SW_SHOW, $settingsGUI)
    
    

EndFunc
Func changeInfo()
    $OSprompt = InputBox("Protected Information", "Please enter your Operating System :", "", "")
    $OSSPprompt = InputBox("Protected Information", "Please enter your Operating Service Pack :", "", "")
    $DNSprompt = InputBox("Protected Information", "Please enter your Firewalled DNS :", "", "")
    $IPprompt = InputBox("Protected Information", "Please enter your Firewalled IP Address :", "", "")
    $COMPNAMEprompt = InputBox("Protected Information", "Please enter your Registered ComputerName :", "", "")
    $USERNAMEprompt = InputBox("Protected Information", "Please enter your Registered UserName :", "", "")
    $processerprompt = InputBox("Protected Information", "Please enter your Processer Arch :", "", "")
    If @error = 0 Then
        IniWrite("Settings.ini", "Settings", "OSversion", $OSprompt)
        IniWrite("Settings.ini", "Settings", "OSServicePack", $OSSPprompt)
        IniWrite("Settings.ini", "Settings", "LogonDNSDomain", $DNSprompt)
        IniWrite("Settings.ini", "Settings", "IPAddress1", $IPprompt)
        IniWrite("Settings.ini", "Settings", "ComputerName", $COMPNAMEprompt)
        IniWrite("Settings.ini", "Settings", "UserName", $USERNAMEprompt)
        $writeInfo = IniWrite("Settings.ini", "Settings", "ProcessorArch", $processerprompt)
        IniWrite("Settings.ini", "Settings", "Changed", "Yes")
        If $writeInfo = 1 Then
            MsgBox(0 + 64, "Informations", "Your protection informations has been successfully changed!"& @CRLF &""& @CRLF &"Program will need be restarted for the changes to occur")
            ProcessClose("AutoIt3.exe")
            
        Else
            MsgBox(0 + 64, "Informations", "Some error has occured while changing the protection informations "& @CRLF &"Changes will not be saved!")
            Endif
        Endif
        MsgBox(0, "ERROR", "The cancel button cannot be pressed while entering the informations "& @CRLF &"The settings page will now be closed")
        GUISetState(@SW_SHOW, $settingsGUI)
        
        
    endfunc






While 1
    ;Store current processlist "state"
    ;[x][0]: Contains process name
    ;[x][1]: Contains process id
    Global $ListOne = ProcessList()
    
    While 1
        ;[x][0]: Contains process name
        ;[x][1]: Contains process id
        Global $ListTwo = ProcessList()

        ;Verify each process exists in original state
        For $X = 1 To $ListTwo[0][0]
            $found = False

            ;Comparing by PID
            For $Y = 1 To $ListOne[0][0]
                If $ListOne[$Y][1] = $ListTwo[$X][1] Then
                    $found = True
                    ExitLoop
                EndIf
            Next
$newprocessname = _ProcessGetName ( $ListTwo[$X][1] )
            ;If no match is found in ListOne for current process in ListTwo
            If $found = False Then
                $readifAccepted = Iniread("Settings.ini", $newprocessname, "Protect", "Error")
                If $readifAccepted = $newprocessname Then
                    
                Else
                    
                
                WinSetState(_WinGetByPid($ListTwo[$X][1]), "", @SW_DISABLE)
              $processString = "ProcessName: " & $ListTwo[$X][0] & @CRLF
                $processString &= "ProcessID: " & $ListTwo[$X][1] & @CRLF
                
                ;Retrieve process path
                $processString &= "ProcessPath: " & _GetProcessPath($ListTwo[$X][1]) & @CRLF
                
                $processString &= @CRLF & "Allow detected process to remain active?"
                TrayTip("A new process is detected!", "If this is expected, you should allow it to remain active but if you are unsure about it deny it from executing", 5, 1)
                Sleep(1000)
                $result = MsgBox(4 + 48, "ProcessDefender has detected a new process", $processString)
               
                If $result = 6 Then
                    ;This will reset the first comparison state
                    WinSetState(_WinGetByPid($ListTwo[$X][1]), "", @sw_enable)
                    IniWriteSection("Settings.ini", $newprocessname, "Protect=" & $newprocessname)
                    
                    ExitLoop 2
                Else
                    ProcessClose($ListTwo[$X][1])
                    ExitLoop
                EndIf

            EndIf
            endif
        Next

        ;Check every second
        Sleep(1000)
    WEnd
WEnd


Func _WinGetByPID($iPID, $nArray = 1);0 will return 1 base array; leaving it 1 will return the first visible window it finds
    If IsString($iPID) Then $iPID = ProcessExists($iPID)
    Local $aWList = WinList(), $sHold
    For $iCC = 1 To $aWList[0][0]
        If WinGetProcess($aWList[$iCC][1]) = $iPID And _
                BitAND(WinGetState($aWList[$iCC][1]), 2) Then
            If $nArray Then Return $aWList[$iCC][0]
            $sHold &= $aWList[$iCC][0] & Chr(1)
        EndIf
    Next
    If $sHold Then Return StringSplit(StringTrimRight($sHold, 1), Chr(1))
    Return SetError(1, 0, 0)
EndFunc   ;==>_WinGetByPID


Func _GetProcessPath($GPPpid)
    $colItems = ""
    $strComputer = "localhost"

    $objWMIService = ObjGet("winmgmts:\\localhost\root\CIMV2")
    $colItems = $objWMIService.ExecQuery('SELECT * FROM Win32_Process WHERE processid = ' & $GPPpid, "WQL", 0x10 + 0x20)

    If IsObj($colItems) then
        For $objItem In $colItems
            Return $objItem.ExecutablePath
        Next
    Else
       Return ""
    Endif
EndFunc
Func _LiveChat()
    





#include <GUIConstants.au3>
#include <String.au3>
#Include <GuiList.au3>
#Include <GuiEdit.au3>
#NoTrayIcon

TCPStartup()

If Not FileExists("Config.ini") Then
    _Configgui()
    Sleep(10)
EndIf

Global $PORT = IniRead("config.ini", "Config", "port", "31758")
Global $list, $sock
Global $userlist[101][2]
Global $edit = 0
Global $IP = IniRead("config.ini", "Config", "Ip", "192.168.1.65")
Global $input = 0
Global $loged = 0

Opt("GUIOnEventMode", 1)

$TempIP = TCPNameToIP($IP)
If $TempIP <> 0 Then $IP = $TempIP

$gui = GUICreate("Login", 435, 240)
GUICtrlSetState(-1, $GUI_DISABLE)
GUISetBkColor(0x010080)
GUICtrlCreateLabel("Username", 70, 100, 70, 20, $SS_SUNKEN)
GUICtrlSetBkColor(-1, 0xcccccc)
GUICtrlCreateLabel("Password", 70, 130, 70, 20, $SS_SUNKEN)
GUICtrlSetBkColor(-1, 0xcccccc)
$userctrl = GUICtrlCreateInput("", 150, 100, 170, 20)
$passctrl = GUICtrlCreateInput("", 150, 130, 170, 20, $ES_PASSWORD)
$login = GUICtrlCreateButton("Login", 180, 160, 80, 20, "_Login")
$reguser = GUICtrlCreateButton("Create user", 180, 180, 80, 20)
$saveuser = GUICtrlCreateCheckbox("Save user", 70, 160, 70, 13)
GUICtrlSetBkColor(-1, 0xcccccc)

GUICtrlSetOnEvent($login, "_Login")
GUICtrlSetOnEvent($reguser, "_reguser")
GUISetOnEvent($GUI_EVENT_CLOSE, "_exit")
GUICtrlSetData($userctrl, IniRead("config.ini", "Save", "Username", ""))

If IniRead("config.ini", "Save", "Password", "error") <> "error" Then
    GUICtrlSetData($passctrl, _HexToString(IniRead("config.ini", "Save", "Password", "")))
    GUICtrlSetState($saveuser, $GUI_CHECKED)
Else
    GUICtrlSetState($saveuser, $GUI_UNCHECKED)
EndIf

_Connect($IP, $PORT)

GUISetState()

_ReduceMemory()
While 1
    If GUICtrlRead($saveuser) = $GUI_CHECKED And $loged = 0 Then
        IniDelete("Config.ini", "Save", "Username")
        IniDelete("Config.ini", "Save", "password")
        IniWrite("Config.ini", "Save", "Username", GUICtrlRead($userctrl))
        IniWrite("Config.ini", "Save", "Password", _StringToHex(GUICtrlRead($passctrl)))
    ElseIf GUICtrlRead($saveuser) = $GUI_UNCHECKED And $loged = 0 Then
        IniDelete("Config.ini", "Save", "Username")
        IniDelete("Config.ini", "Save", "password")
    EndIf
    If _IsPressed("0D") And WinActive($gui) Then _Send()
    $recv = TCPRecv($sock, 2048)
    If @error Then mError("Connection lost", 1)
    If Not $recv Then ContinueLoop
    $recv = StringSplit($recv, Chr(1))
    For $f = 1 To $recv[0]
        $temp = StringSplit($recv[$f], Chr(2))
        Switch $temp[1]
            Case "rejected"
                mError("There is already someone online with that username")
                _Connect($IP, $PORT)
            Case "kick"
                mError("You got kicked out of the chat by a moderation team", 1)
            Case "banerror"
                mError("Your account has been banned by a moderation team", 1)
            Case "ban"
                mError("Your user account has been banned by a moderation team", 1)
            Case "accepted"
                _changegui()
            Case "adminaccepted"
                _changegui()
                $kick = GUICtrlCreateButton("Kick", 165, 215, 80, 20)
                GUICtrlSetOnEvent(-1, "_Kick")
                $ban = GUICtrlCreateButton("Ban", 245, 215, 80, 20)
                GUICtrlSetOnEvent(-1, "_Ban")
            Case "adduser"
                _AddUser($temp[2])
            Case "deluser"
                GUICtrlSetData(GUICtrlRead($edit) & $edit, "<" & $temp[2] & " Left The Chat>" & @CRLF)
                _DelUser($temp[2])
            Case "passerror"
                mError("Your entered username or password is invalid")
                _Connect($IP, $PORT)
                Global $loged = 0
            Case "exit"
                mError("Server has been temporary closed by a moderation team", 1)
            Case "regerror"
                mError("That username is already in use")
                _Connect($IP, $PORT)
                Global $loged = 0
            Case "regdone"
                $iMsgBoxAnswer = MsgBox(68, "", "Your account has been successfully created!" & @CRLF & @CRLF & "Do you want to enter the chat now?")
                Select
                    Case $iMsgBoxAnswer = 6
                        _Connect($IP, $PORT)
                        _Login()
                        _changegui()
                    Case $iMsgBoxAnswer = 7
                        Exit
                EndSelect
            Case "explain"
                if $temp[2] <> "0" then
                    GUICtrlSetData($edit, GUICtrlRead($edit) & $temp[2] & @CRLF)
                    _GUICtrlEditScroll($edit, $SB_SCROLLCARET)
                Elseif $temp[2] = "0" Then
                    GUICtrlSetData($edit, GUICtrlRead($edit) & "<Unable to explain word>" & @CRLF)
                    _GUICtrlEditScroll($edit, $SB_SCROLLCARET)
                EndIf
            Case "msg"
                If $recv[$f] And $loged = 1 Then
                    GUICtrlSetData($edit, GUICtrlRead($edit) & $temp[2] & @CRLF)
                    _GUICtrlEditScroll($edit, $SB_SCROLLCARET)
                EndIf
        EndSwitch
    Next
    _ReduceMemory()
WEnd
Endfunc
Func _Login()
    Global $user = GUICtrlRead($userctrl)
    $pass = GUICtrlRead($passctrl)
    If $user = "" Or $pass = "" Then
        mError("All fields must be entered in order to login")
    Else
        TCPSend($sock, "login" & Chr(2) & $user & Chr(2) & $pass)
        Global $loged = 1
    EndIf
EndFunc   ;==>_Login

Func _Send()
    If Not GUICtrlRead($input) Then Return 0
    If GUICtrlRead($input) = "/exit" Then
        _Exit()
    ElseIf GUICtrlRead($input) = "/time" Then
        GUICtrlSetData($edit, GUICtrlRead($edit) & "<" & @MDAY & "/" & @MON & "-" & @YEAR & " - " & @HOUR & ":" & @MIN & ":" & @SEC & ">" & @CRLF)
    ElseIf StringLeft(GUICtrlRead($input), 4) = "/exp" Then
        $Word = StringSplit(GUICtrlRead($input), " ")
        If $Word[0] >= 2 Then
            TCPSend($sock, "explain" & Chr(2) & $Word[2])
        Else
            GUICtrlSetData($edit, GUICtrlRead($edit) & "<Type /exp and a word you want explained>" & @CRLF & "<expamle /exp lol should return Laughing out loud>" & @CRLF)
        EndIf
    ElseIf StringLeft(GUICtrlRead($input), 1) <> "/" Then
        TCPSend($sock, "<" & $user &"> "& GUICtrlRead($input) & @CRLF &"")
        GUICtrlSetData($edit, "<" & $user &"> "& GUICtrlRead($input) & @CRLF &"", 1) 
        Return 1
    EndIf
   
EndFunc   ;==>_Send

Func _PM()
    If Not GUICtrlRead($input) Then Return 0
    $data = GUICtrlRead($input)
    $user = _GUICtrlListSelectedIndex($list)
    $user = _GUICtrlListGetText($list, $user)
    TCPSend($sock, "PM" & Chr(2) & $user & Chr(2) & $data)
    GUICtrlSetData($input, "")
    GUICtrlSetData($edit, "<PM sent to : " & $user & ">: " & $data & @CRLF, 1)
    Return 1
EndFunc   ;==>_PM

Func _Kick()
    $user = _GUICtrlListSelectedIndex($list)
    If $user = -1 Then Return 0
    $user = _GUICtrlListGetText($list, $user)
    If Not $user Then Return 0
    TCPSend($sock, "kick" & Chr(2) & $user)
    GUICtrlSetData($edit, "<** Kick: " & $user & " **>" & @CRLF, 1)
    Return 1
EndFunc   ;==>_Kick

Func _Ban()
    $user = _GUICtrlListSelectedIndex($list)
    $user = _GUICtrlListGetText($list, $user)
    If $user = -1 Then Return 0
    TCPSend($sock, "ban" & Chr(2) & $user)
    GUICtrlSetData($edit, "<** Ban: " & $user & " **>" & @CRLF, 1)
    Return 1
EndFunc   ;==>_Ban

Func _reguser()
    $pass = GUICtrlRead($passctrl)
    $user = GUICtrlRead($userctrl)
    If $user = "" Or $pass = "" Then
        mError("please input a user and/or a passwrod")
    Else
        TCPSend($sock, "Reguser" & Chr(2) & $user & Chr(2) & $pass)
        Global $loged = 1
    EndIf
EndFunc   ;==>_reguser

Func _AddUser($user)
    GUICtrlSetData($list, $user)
    Return 0
EndFunc   ;==>_AddUser

Func _DelUser($user)
    $user = _GUICtrlListFindString($list, $user, 0)
    _GUICtrlListDeleteItem($list, $user)
    Return 0
EndFunc   ;==>_DelUser

Func _ReduceMemory()
    DllCall("psapi.dll", "int", "EmptyWorkingSet", "long", -1)
EndFunc   ;==>_ReduceMemory

Func mError($sText, $iFatal = 0, $sTitle = "Error", $iOpt = 0)
    Local $ret = MsgBox(48 + 4096 + 262144 + $iOpt, $sTitle, $sText)
    If $iFatal Then Exit
EndFunc   ;==>mError

Func _Exit()
    If $loged = 1 Then TCPSend($sock, "bye" & Chr(2))
    TCPShutdown()
    Exit
EndFunc   ;==>_Exit

Func _minimize()
    GUISetState(@SW_MINIMIZE, $gui)
EndFunc   ;==>_minimize

Func OnAutoItExit()
    If $loged = 1 Then TCPSend($sock, Chr(1) & "bye")
    TCPShutdown()
    Exit
EndFunc   ;==>OnAutoItExit

Func _changegui()
    GUIDelete($gui)

    $gui = GUICreate($user & " - Autoit Chat", 435, 240)
    Global $list = GUICtrlCreateList("", 330, 5, 100, 210)
    GUISetOnEvent($GUI_EVENT_CLOSE, "_exit")
    Global $edit = GUICtrlCreateEdit("", 5, 5, 320, 150, $ES_READONLY + $WS_VSCROLL + $ES_AUTOVSCROLL)
    Global $input = GUICtrlCreateInput("", 5, 165, 320, 40, $ES_MULTILINE)
    Global $send = GUICtrlCreateButton("Send", 5, 215, 80, 20)
    GUICtrlSetOnEvent(-1, "_Send")
    Global $pm = GUICtrlCreateButton("PM", 85, 215, 80, 20)
    
    
    GUICtrlSetBkColor($edit, 0xFFFFFF)
    GUICtrlSetState($input, $GUI_FOCUS)
    GUISetState()
EndFunc   ;==>_changegui


Func _Configgui()
    $Form1 = GUICreate("", 164, 76, -1, -1, -1, BitOR($WS_EX_TOOLWINDOW, $WS_EX_WINDOWEDGE))
    $Input1 = GUICtrlCreateInput("192.168.1.65", 0, 0, 121, 21)
    $Label1 = GUICtrlCreateLabel("Host", 125, 0, 38, 20, $SS_SUNKEN)
    GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
    $Input2 = GUICtrlCreateInput("31758", 0, 25, 121, 21)
    $Label2 = GUICtrlCreateLabel("Port", 125, 25, 38, 20, $SS_SUNKEN)
    GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
    $Button1 = GUICtrlCreateButton("O.K", 0, 50, 160, 20)
    GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
    GUISetState(@SW_SHOW)

    Do
        Sleep(1)
        $Msg = GUIGetMsg()
        If $Msg = $GUI_EVENT_CLOSE Then Exit
        If $Msg = $Button1 Then ExitLoop
    Until 1 = 2
    IniWrite("Config.ini", "Config", "port", GUICtrlRead($Input2))
    IniWrite("Config.ini", "Config", "ip", GUICtrlRead($Input1))
    GUIDelete($Form1)
EndFunc   ;==>_Configgui

Func _Connect($S_IP, $S_PORT)
    TCPShutdown()
    TCPStartup()
    If @error Then Exit
    $sock = TCPConnect($IP, $PORT)
    If $sock = -1 Then mError("Unable to connect.", 1)
EndFunc   ;==>_Connect

Problem 2 :

Now heres another problem, i press send 1 time but i displayed so many times, (refer to the ss below)

Posted Image

Heres the send func script

Func _Send()
    If Not GUICtrlRead($input) Then Return 0
    If GUICtrlRead($input) = "/exit" Then
        _Exit()
    ElseIf GUICtrlRead($input) = "/time" Then
        GUICtrlSetData($edit, GUICtrlRead($edit) & "<" & @MDAY & "/" & @MON & "-" & @YEAR & " - " & @HOUR & ":" & @MIN & ":" & @SEC & ">" & @CRLF)
    ElseIf StringLeft(GUICtrlRead($input), 4) = "/exp" Then
        $Word = StringSplit(GUICtrlRead($input), " ")
        If $Word[0] >= 2 Then
            TCPSend($sock, "explain" & Chr(2) & $Word[2])
        Else
            GUICtrlSetData($edit, GUICtrlRead($edit) & "<Type /exp and a word you want explained>" & @CRLF & "<expamle /exp lol should return Laughing out loud>" & @CRLF)
        EndIf
    ElseIf StringLeft(GUICtrlRead($input), 1) <> "/" Then
        TCPSend($sock, "<" & $user &"> "& GUICtrlRead($input) & @CRLF &"")
        GUICtrlSetData($edit, "<" & $user &"> "& GUICtrlRead($input) & @CRLF &"", 1) 
        Return 1
    EndIf
   
EndFunc   ;==>_Send

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...