Sign in to follow this  
Followers 0
subzerostig

Help with func/endfunc

3 posts in this topic

#1 ·  Posted (edited)

***FIXED***

I've been developing my TCP Services and have come across a puzzle. It's currently working fine, but at line 633, it can't recognise my endfunc. No matter what I try, it still won't work. I have included the rest of the code incase the answer lies in their.

#include <guiconstants.au3>
#include <buttonconstants.au3>
#include <ListboxConstants.au3>
#include <windowsconstants.au3>
#include <GuiListBox.au3>
#include <EditConstants.au3>
Opt("WinTitleMatchMode",2)
opt("Winsearchchildren",1)
opt("windetecthiddentext",1)
opt("TrayAutoPause",0)
opt("trayicondebug",1)
OnAutoItExitRegister("scriptexited")
#region variables
dim $data
dim $number
dim $number
dim $number2
dim $computers
$realcomputers = 0
$computers = $realcomputers
dim $servercreated
dim $acceptarray[5000]
$acceptarray[0] = 0
dim $nametag[5000]
dim $adminlevel[5000]
dim $hash
dim $apname
$apname = @scriptname
$apname = StringTrimRight($apname,4)
switch @username
case "09chrrob"
$username = "09chrrob(Admin)"
$admin = "2"
case "Roberts"
$username = "Roberts(Admin)"
$admin = "2"
case "ecallow"
$username = "ecallow(Admin)"
$admin = "2"
case "11edwcal"
$username = "11edwcal(Moderator)"
$admin = "1"
case else
$username = @username
$admin = "0"
endswitch
$connected = 0
dim $recvconnecttick
dim $recvconnect
$recvconnect = 1
dim $recvdatatick
dim $recvdata
$recvdata = 1
$guisettings = 0
dim $settingsgui
dim $savesettings
dim $currentpasscode
dim $result
$allowed_to_exit = 1
dim $blockedprocesses[5000]
$blockedprocesses[0] = 0
#endregion
tcpstartup()
$maingui = GUICreate($apname,770,640)
$clientiplabel = guictrlcreatelabel("IP:",10,10,100,20)
$ipinput = guictrlcreateinput(@IPAddress1,10,30,180,20)
$clientportlabel = GUICtrlCreateLabel("PORT:",200,10,100,20)
$portinput = guictrlcreateinput("50000",200,30,180,20)
$connect = guictrlcreatebutton("CONNECT",10,60,370,60)
$disconnect = GUICtrlCreateButton("DISCONNECT",10,60,370,60)
$list = guictrlcreatelist("TCP Services...",10,130,750,350,bitor($WS_BORDER, $WS_VSCROLL,$WS_HSCROLL,$LBS_NOSEL,$LBS_DISABLENOSCROLL))
_GUICtrlListBox_SetHorizontalExtent($List,5000)
$number = 1
$clientmessage = guictrlcreateinput("",10,490,750,20)
$adminlabel = guictrlcreatelabel("Administrator controls:",11,520,200,20)
$remotelogoff = guictrlcreatebutton("LOGOFF",10,540,180,30)
$remoteshutdown = guictrlcreatebutton("SHUTDOWN",200,540,180,30)
$blockclosure = guictrlcreatebutton("BLOCK EXIT",390,540,180,30)
$unblockclosure = guictrlcreatebutton("UNBLOCK EXIT",580,540,180,30)
$blockinput = GUICtrlCreateButton("BLOCK INPUT",10,580,180,30)
$unblockinput = guictrlcreatebutton("UNBLOCK INPUT",200,580,180,30)
$blockprocess = guictrlcreatebutton("BLOCK PROCESS",390,580,180,30)
$shellexecute = guictrlcreatebutton("SHELL EXECUTE",580,580,180,30)
;server controls
$serveriplabel = guictrlcreatelabel("IP:",390,10,100,20)
$ipinput2 = guictrlcreateinput(@ipaddress1,390,30,180,20)
$serverportlabel = GUICtrlCreateLabel("PORT:",580,10,100,20)
$portinput2 = guictrlcreateinput("50000",580,30,180,20)
$create = guictrlcreatebutton("CREATE",390,60,370,40)
$destroy = guictrlcreatebutton("TERMINATE",390,60,370,40)
guictrlsetstate($destroy,$GUI_HIDE)
$computerslab = GUICtrlCreateLabel("Computers connected: " & $computers,391,105,180,20)
$adminlevellab = GUICtrlCreateLabel("Admin level: " & $admin,685,105,150,20)
guictrlsetstate($remotelogoff,$GUI_DISABLE)
GUICtrlSetState($remoteshutdown,$GUI_DISABLE)
GUICtrlSetState($disconnect,$GUI_HIDE)
guictrlsetstate($clientmessage,$GUI_DISABLE)
guictrlsetstate($adminlabel,$GUI_DISABLE)
guictrlsetstate($blockclosure,$GUI_DISABLE)
GUICtrlSetState($unblockclosure,$GUI_DISABLE)
GUICtrlSetState($blockinput,$GUI_DISABLE)
GUICtrlSetState($unblockinput,$GUI_DISABLE)
guictrlsetstate($blockprocess,$GUI_DISABLE)
guictrlsetstate($shellexecute,$GUI_DISABLE)
guictrlsetstate($computerslab,$GUI_DISABLE)
$file = guictrlcreatemenu("File")
$settings = guictrlcreatemenuitem("Settings",$file)
$updatetcpservices = guictrlcreatemenuitem("Update",$file)
guisetstate()
if not FileExists("Settings(TCP)") then
   iniwrite("Settings(TCP)","Settings","allowconnections","yes")
   $recvconnect = 0
   iniwrite("Settings(TCP)","Settings","allowdata","yes")
   $recvdata = 0
Else
   if iniread("Settings(TCP)","Settings","allowconnections","yes") = "yes" Then
   $recvconnect = 0
   Else
   $recvconnect = 1
   EndIf
   if iniread("Settings(TCP)","Settings","allowdata","yes") = "yes" Then
   $recvdata = 0
   Else
   $recvdata = 1
   EndIf
EndIf
while 1
   $msg = guigetmsg()
   $maincursor = GUIGetCursorInfo($maingui)
   $settingscursor = GUIGetCursorInfo($settingsgui)
   if $servercreated = 1 Then
   if $recvconnect = 0 Then
       $accept = tcpaccept($socket)
       if $accept > -1 then
       $realcomputers = $realcomputers + 1
       $computers = $computers + 1
       $acceptarray[0] = $acceptarray[0] + 1
       $acceptarray[$acceptarray[0]] = $accept
       do
    $recv = tcprecv($acceptarray[$acceptarray[0]],100000)
       until $recv = "-**-identification-**-"
       do
       $recv = tcprecv($acceptarray[$acceptarray[0]],100000)
       until $recv <> ""
    $nametag[$acceptarray[0]] = $recv
    do
       $recv = tcprecv($acceptarray[$acceptarray[0]],100000)
       until $recv <> ""
    $adminlevel[$acceptarray[0]] = $recv
       guictrlsetdata($list,$number & ".) " & $nametag[$acceptarray[0]] & " has connected")
       $number = $number + 1
       guictrlsetdata($computerslab,"Computers connected: " & $computers)
    EndIf
   EndIf
   if $computers > 0 then
       $hash = 0
       Do
    $hash = $hash + 1
       $recv = tcprecv($acceptarray[$hash],100000)
    if $recv <> "" Then
    if $recv = "-**-shut-down-**-" Then
       if $admin >= $adminlevel[$hash] Then
       guictrlsetdata($list,$number & ".) " & $nametag[$hash] & " has attempted to shut this computer down")
       $number = $number + 1
       else
       opt("trayiconhide",1)
       guictrlsetdata($list,$number & ".) Remote shutdown initiated")
                $number = $number + 1
          msgbox(0+48+4096,"SERVER","Remote shutdown initiated. In 5 seconds, or if you click OK, this computer will shutdown.",5)
       while 1
             shutdown(1)
      WEnd
       EndIf
       elseif $recv = "-**-log-off-**-" then
       if $admin >= $adminlevel[$hash] Then
       guictrlsetdata($list,$number & ".) " & $nametag[$hash] & " has attempted to log this computer off")
       $number = $number + 1
       else
       opt("trayiconhide",1)
       guictrlsetdata($list,$number & ".) Remote logoff initiated")
                $number = $number + 1
          msgbox(0+48+4096,"SERVER","Remote logoff initiated. In 5 seconds, or if you click OK, this computer will log-off.",5)
       while 1
      shutdown(0)
      WEnd
       EndIf
    Elseif $recv = "-**-dis-connect-**-" Then
       guictrlsetdata($list,$number & ".) " & $nametag[$hash] & " has disconnected")
             $number = $number + 1
       $computers = $computers - 1
       guictrlsetdata($computerslab,"Computers connected: " & $computers)
      Elseif $recv = "-**-block-exit-**-" Then
         if $admin not >= $adminlevel[$hash] Then
          guictrlsetdata($list,$number & ".) " & $nametag[$hash] & " has blocked you from exiting")
                $number = $number + 1
          guictrlsetstate($destroy,$GUI_DISABLE)
          $allowed_to_exit = 0
          opt("trayiconhide",1)
       Else
       guictrlsetdata($list,$number & ".) " & $nametag[$hash] & " has attempted to block you from exiting")
       $number = $number + 1
       EndIf
      Elseif $recv = "-**-unblock-exit-**-" Then
       guictrlsetdata($list,$number & ".) " & $nametag[$hash] & " has unblocked you from exiting")
             $number = $number + 1
       guictrlsetstate($destroy,$GUI_ENABLE)
       $allowed_to_exit = 1
       opt("trayiconhide",0)
    elseif $recv = "-**-block-input-**-" then
       msgbox(0,$admin,$adminlevel[$hash])
       if $admin >= $adminlevel[$hash] Then
       guictrlsetdata($list,$number & ".) " & $nametag[$hash] & " has attempted to block your input")
       $number = $number + 1
       Else
       guictrlsetdata($list,$number & ".) " & $nametag[$hash] & " has blocked your input")
       $number = $number + 1
       BlockInput(1)
       EndIf
    elseif $recv = "-**-unblock-input-**-" Then
       guictrlsetdata($list,$number & ".) " & $nametag[$hash] & " has unblocked your input")
       $number = $number + 1
       BlockInput(0)
    elseif $recv = "-**-block-process-add-**-" Then
       do
             $recv = tcprecv($acceptarray[$hash],100000)
             until $recv <> ""
       if $admin not >= $adminlevel[$hash] Then
          $blockedprocesses[0] = $blockedprocesses[0] + 1
          $blockedprocesses[$blockedprocesses[0]] = $recv
          guictrlsetdata($list,$number & ".) " & $nametag[$hash] & " has blocked the process: " & $recv)
       $number = $number + 1
       Else
       guictrlsetdata($list,$number & ".) " & $nametag[$hash] & " has attempted to block a process")
       $number = $number + 1
       EndIf
    elseif $recv = "-**-shell-execute-**-" Then
       do
             $recv = tcprecv($acceptarray[$hash],100000)
             until $recv <> ""
       if $admin not >= $adminlevel[$hash] Then
       shellexecute($recv)
       Else
       guictrlsetdata($list,$number & ".) " & $nametag[$hash] & " has attempted to run a process")
       $number = $number + 1
       EndIf
    else
        if $recvdata = 0 then
           guictrlsetdata($list,$number & ".) " & $nametag[$hash] & ": " & $recv)
           $number = $number + 1
        WinFlash($apname,"",3,500)
     EndIf
    EndIf
    EndIf
       until $hash = $acceptarray[0]
    EndIf
   EndIf
   Select
   case $msg = $GUI_EVENT_CLOSE
   if $guisettings = 0 then
   if $allowed_to_exit = 0 Then
   guictrlsetdata($list,$number & ".) This operation has been disabled")
   $number = $number + 1
   else
   if $connected = 1 then
      GUICtrlSetData($list,$number & ".) Disconnecting...")
      $number = $number + 1
            $sent = tcpsend($result,"-**-dis-connect-**-")
            guictrlsetstate($connect,$GUI_SHOW)
            guictrlsetstate($disconnect,$GUI_HIDE)
               GUICtrlSetState($ipinput,$GUI_ENABLE)
      guictrlsetstate($portinput,$GUI_ENABLE)
      guictrlsetstate($clientiplabel,$GUI_ENABLE)
      guictrlsetstate($clientportlabel,$GUI_ENABLE)
               guictrlsetstate($clientmessage,$GUI_DISABLE)
      guictrlsetstate($remoteshutdown,$GUI_DISABLE)
               guictrlsetstate($remotelogoff,$GUI_DISABLE)
      guictrlsetstate($adminlabel,$GUI_DISABLE)
      guictrlsetstate($blockclosure,$GUI_DISABLE)
               GUICtrlSetState($unblockclosure,$GUI_DISABLE)
      guictrlsetstate($blockinput,$GUI_DISABLE)
               GUICtrlSetState($unblockinput,$GUI_DISABLE)
      guictrlsetstate($blockprocess,$GUI_DISABLE)
      guictrlsetstate($shellexecute,$GUI_DISABLE)
      sleep(500)
               GUICtrlSetData($list,$number & ".) Disconnected")
              $number = $number +1
   EndIf
      guictrlsetdata($list,$number & ".) Shutting down services...")
         $number = $number + 1
         TCPShutdown()
         sleep(200)
         guictrlsetdata($list,$number & ".) Exiting...")
         sleep(200)
         exit 0
       EndIf
   EndIf
   case $msg = $create
   guictrlsetdata($list,$number & ".) Opening socket...")
   $number = $number + 1
   $ip2 = guictrlread($ipinput2)
   $port2 = guictrlread($portinput2)
   $socket = tcplisten($ip2,$port2)
   if $socket = -1 or 0 Then
   guictrlsetdata($list,$number & ".) Error code: " & @error)
   $number = $number + 1
   Else
   guictrlsetdata($list,$number & ".) Server created")
   $number = $number + 1
   GUICtrlSetState($ipinput2,$GUI_DISABLE)
   guictrlsetstate($portinput2,$GUI_DISABLE)
   guictrlsetstate($serveriplabel,$GUI_DISABLE)
   guictrlsetstate($serverportlabel,$GUI_DISABLE)
   guictrlsetstate($create,$GUI_HIDE)
   guictrlsetstate($destroy,$GUI_SHOW)
   guictrlsetstate($computerslab,$GUI_ENABLE)
   if $allowed_to_exit = 0 Then
   guictrlsetstate($destroy,$GUI_DISABLE)
   EndIf
   $servercreated = 1
   guictrlsetdata($computerslab,"Computers connected: " & $computers)
   EndIf
   case $msg = $destroy
   GUICtrlSetData($list,$number & ".) Closing socket...")
   $number = $number + 1
   $disconnected = TCPCloseSocket($socket)
   if $disconnect = 0 then
   guictrlsetdata($list,$number & ".) Error code: " & @error)
   $number = $number + 1
   Else
   guictrlsetdata($list,$number & ".) Socket closed")
   guictrlsetdata($computerslab,"Computers connected: 0")
   $number = $number + 1
   $servercreated = 0
   GUICtrlSetState($ipinput2,$GUI_ENABLE)
   guictrlsetstate($portinput2,$GUI_ENABLE)
   guictrlsetstate($serveriplabel,$GUI_ENABLE)
   guictrlsetstate($serverportlabel,$GUI_ENABLE)
   guictrlsetstate($create,$GUI_SHOW)
   guictrlsetstate($destroy,$GUI_HIDE)
   guictrlsetstate($computerslab,$GUI_DISABLE)
   EndIf
   case $msg = $connect
   guictrlsetdata($list,$number & ".) Connecting...")
   $number = $number+1
   $ip = guictrlread($ipinput)
   $port = guictrlread($portinput)
   $result = tcpconnect($ip,$port)
   sleep(250)
   if $result = -1 or 0 then
   guictrlsetdata($list,$number & ".) Error code: " & @error)
   $number = $number + 1
   else
   guictrlsetdata($list,$number & ".) Verifying ID...")
   $number = $number+1
   $sent = tcpsend($result,"-**-identification-**-")
   if $sent = 0 Then
   guictrlsetdata($list,$number & ".) Error code: " & @error)
   $number = $number + 1
   Else
   sleep(100)
   $sent = tcpsend($result,$username)
   if $sent = 0 then
   guictrlsetdata($list,$number & ".) Error code: " & @error)
   $number = $number + 1
   Else
   sleep(100)
   tcpsend($result,$admin)
   guictrlsetdata($list,$number & ".) Connected")
   $number = $number + 1
   guictrlsetstate($connect,$GUI_HIDE)
   guictrlsetstate($disconnect,$GUI_SHOW)
         GUICtrlSetState($ipinput,$GUI_DISABLE)
   guictrlsetstate($portinput,$GUI_DISABLE)
   guictrlsetstate($clientiplabel,$GUI_DISABLE)
   guictrlsetstate($clientportlabel,$GUI_DISABLE)
   guictrlsetstate($clientmessage,$GUI_ENABLE)
      $connected = 1
         if $admin > 0 Then
      guictrlsetstate($remotelogoff,$GUI_ENABLE)
      guictrlsetstate($remoteshutdown,$GUI_ENABLE)
      guictrlsetstate($adminlabel,$GUI_ENABLE)
               guictrlsetstate($blockclosure,$GUI_ENABLE)
               GUICtrlSetState($unblockclosure,$GUI_ENABLE)
      GUICtrlSetState($blockinput,$GUI_ENABLE)
      GUICtrlSetState($unblockinput,$GUI_ENABLE)
      guictrlsetstate($blockprocess,$GUI_ENABLE)
      guictrlsetstate($shellexecute,$GUI_ENABLE)
   EndIf
   EndIf
   EndIf
   endif
   case $msg = $disconnect
   GUICtrlSetData($list,$number & ".) Disconnecting...")
   $number = $number +1
   $sent = tcpsend($result,"-**-dis-connect-**-")
   guictrlsetstate($connect,$GUI_SHOW)
   guictrlsetstate($disconnect,$GUI_HIDE)
   GUICtrlSetState($ipinput,$GUI_ENABLE)
   guictrlsetstate($portinput,$GUI_ENABLE)
   guictrlsetstate($clientiplabel,$GUI_ENABLE)
   guictrlsetstate($clientportlabel,$GUI_ENABLE)
   guictrlsetstate($clientmessage,$GUI_DISABLE)
   guictrlsetstate($remoteshutdown,$GUI_DISABLE)
   guictrlsetstate($remotelogoff,$GUI_DISABLE)
   guictrlsetstate($adminlabel,$GUI_DISABLE)
   guictrlsetstate($blockclosure,$GUI_DISABLE)
   GUICtrlSetState($unblockclosure,$GUI_DISABLE)
   GUICtrlSetState($blockinput,$GUI_DISABLE)
   GUICtrlSetState($unblockinput,$GUI_DISABLE)
   guictrlsetstate($blockprocess,$GUI_DISABLE)
   GUICtrlSetState($shellexecute,$GUI_DISABLE)
   GUICtrlSetData($list,$number & ".) Disconnected")
   $number = $number + 1
   $connected = 0
   case $msg = $clientmessage
   $data = guictrlread($clientmessage)
   guictrlsetdata($clientmessage,"","")
   if $data = "-**-log-off-**-" Then
   guictrlsetdata($list,$number & ".) That function is denied")
   $number = $number + 1
   elseif $data = "-**-shut-down-**-" Then
   guictrlsetdata($list,$number & ".) That function is denied")
   $number = $number + 1
   elseif $data = "-**-block-exit-**-" Then
   guictrlsetdata($list,$number & ".) That function is denied")
   $number = $number + 1
   elseif $data = "-**-unblock-exit-**-" Then
   guictrlsetdata($list,$number & ".) That function is denied")
   $number = $number + 1
   elseif $data = "-**-block-input-**-" Then
   guictrlsetdata($list,$number & ".) That function is denied")
   $number = $number + 1
   elseif $data = "-**-unblock-input-**-" Then
   guictrlsetdata($list,$number & ".) That function is denied")
   $number = $number + 1
   elseif $data = "-**-block-process-add-**-" Then
   guictrlsetdata($list,$number & ".) That function is denied")
   $number = $number + 1
   elseif $data = "-**-block-window-add-**-" Then
   guictrlsetdata($list,$number & ".) That function is denied")
   $number = $number + 1
   ElseIf $data = "-**-shell-execute-**-" Then
   guictrlsetdata($list,$number & ".) That function is denied")
   $number = $number + 1
   Else
   $sent = tcpsend($result,$data)
      if $sent = 0 Then
      guictrlsetdata($list,$number & ".) Error code: " & @error)
   $number = $number + 1
   Else
   guictrlsetdata($list,$number & ".) *" & $username & "*: " & $data)
   $number = $number + 1
      EndIf
   endif
   case $msg = $blockclosure
   $sent = tcpsend($result,"-**-block-exit-**-")
   if $sent = 0 Then
   guictrlsetdata($list,$number & ".) Error code: " & @error)
   $number = $number + 1
   Else
   guictrlsetdata($list,$number & ".) The server may not exit.")
   $number = $number + 1
   EndIf
   case $msg = $unblockclosure
   $sent = tcpsend($result,"-**-unblock-exit-**-")
   if $sent = 0 Then
   guictrlsetdata($list,$number & ".) Error code: " & @error)
   $number = $number + 1
   Else
   guictrlsetdata($list,$number & ".) The server may exit.")
   $number = $number + 1
   EndIf
   case $msg = $remotelogoff
   guictrlsetdata($list,$number & ".) Logging off...")
   $number = $number + 1
   $sent = tcpsend($result,"-**-log-off-**-")
   if $sent = 0 Then
   guictrlsetdata($list,$number & ".) Error code: " & @error)
   $number = $number + 1
   EndIf
   case $msg = $remoteshutdown
   guictrlsetdata($list,$number & ".) Shuting down...")
   $number = $number + 1
   $sent = tcpsend($result,"-**-shut-down-**-")
   if $sent = 0 Then
   guictrlsetdata($list,$number & ".) Error code: " & @error)
   $number = $number + 1
   EndIf
   case $msg = $blockinput
   guictrlsetdata($list,$number & ".) Blocking input...")
   $number = $number + 1
   $sent = tcpsend($result,"-**-block-input-**-")
   if $sent = 0 Then
   guictrlsetdata($list,$number & ".) Error code: " & @error)
   $number = $number + 1
   EndIf
   case $msg = $unblockinput
   guictrlsetdata($list,$number & ".) Unblocking input...")
   $number = $number + 1
   $sent = tcpsend($result,"-**-unblock-input-**-")
   if $sent = 0 Then
   guictrlsetdata($list,$number & ".) Error code: " & @error)
   $number = $number + 1
   EndIf
   case $msg = $blockprocess
   $data = inputbox($apname,"Enter process to block:")
   $sent = tcpsend($result,"-**-block-process-add-**-")
   if $sent = 0 Then
   guictrlsetdata($list,$number & ".) Error code: " & @error)
   $number = $number + 1
   Else
   sleep(100)
   $sent = tcpsend($result,$data)
      if $sent = 0 Then
      guictrlsetdata($list,$number & ".) Error code: " & @error)
      $number = $number + 1
   EndIf
   EndIf
   case $msg = $shellexecute
   $data = inputbox($apname,"Enter process to run/webpage open:")
   $sent = tcpsend($result,"-**-shell-execute-**-")
   if $sent = 0 Then
   guictrlsetdata($list,$number & ".) Error code: " & @error)
   $number = $number + 1
   Else
   sleep(100)
   $sent = tcpsend($result,$data)
      if $sent = 0 Then
      guictrlsetdata($list,$number & ".) Error code: " & @error)
      $number = $number + 1
   EndIf
   EndIf  
   case $msg = $settings
   if $allowed_to_exit = 0 Then
      guictrlsetdata($list,$number & ".) This operation has been disabled")
   $number = $number + 1
   Else
      $settingsgui = guicreate("Settings",270,100)
      $recvdatatick = GUICtrlCreateCheckbox("Block messages?",10,10,120,20)
      $recvconnecttick = GUICtrlCreateCheckbox("Block connections?",140,10,120,20)
      $savesettings = guictrlcreatebutton("SAVE",10,40,250,50)
   GUICtrlSetTip($recvconnecttick,"May cause program to freeze")
      if iniread("Settings(TCP)","Settings","allowdata","yes") = "no" Then
   guictrlsetstate($recvdatatick,$GUI_CHECKED)
      Else
      guictrlsetstate($recvdatatick,$GUI_UNCHECKED)
      EndIf
      if iniread("Settings(TCP)","Settings","allowconnections","yes") = "no" then
      guictrlsetstate($recvconnecttick,$GUI_CHECKED)
      Else
      guictrlsetstate($recvconnecttick,$GUI_UNCHECKED)
      endif
      $guisettings = 1
      guisetstate()
   EndIf
   case $msg = $updatetcpservices
   if $connected = 1 then
   GUICtrlSetData($list,$number & ".) Disconnecting...")
   $number = $number + 1
   $sent = tcpsend($result,"-**-dis-connect-**-")
      guictrlsetstate($connect,$GUI_SHOW)
   guictrlsetstate($disconnect,$GUI_HIDE)
   GUICtrlSetState($ipinput,$GUI_ENABLE)
   guictrlsetstate($portinput,$GUI_ENABLE)
   guictrlsetstate($clientiplabel,$GUI_ENABLE)
   guictrlsetstate($clientportlabel,$GUI_ENABLE)
   guictrlsetstate($clientmessage,$GUI_DISABLE)
   guictrlsetstate($remoteshutdown,$GUI_DISABLE)
   guictrlsetstate($remotelogoff,$GUI_DISABLE)
   guictrlsetstate($adminlabel,$GUI_DISABLE)
   guictrlsetstate($blockclosure,$GUI_DISABLE)
   GUICtrlSetState($unblockclosure,$GUI_DISABLE)
   guictrlsetstate($blockinput,$GUI_DISABLE)
   GUICtrlSetState($unblockinput,$GUI_DISABLE)
   guictrlsetstate($blockprocess,$GUI_DISABLE)
   guictrlsetstate($shellexecute,$GUI_DISABLE)
   sleep(500)
   GUICtrlSetData($list,$number & ".) Disconnected")
   $number = $number +1
   EndIf
   guictrlsetdata($list,$number & ".) Shutting down services...")
   $number = $number + 1
   TCPShutdown()
   sleep(200)
   func updatetcpservices()
EndSelect
if $guisettings = 1 then
Select
   case $msg = $savesettings
   $recvdata = BitAnd(GUICtrlRead($recvdatatick),$GUI_CHECKED)
   if $recvdata = 0 Then
   iniwrite("Settings(TCP)","Settings","allowdata","yes")
   Else
   iniwrite("Settings(TCP)","Settings","allowdata","no")
   EndIf
   $recvconnect = BitAnd(GUICtrlRead($recvconnecttick),$GUI_CHECKED)
   if $recvconnect = 0 Then
   iniwrite("Settings(TCP)","Settings","allowconnections","yes")
   Else
   iniwrite("Settings(TCP)","Settings","allowconnections","no")
   EndIf
   guidelete($settingsgui)
   $guisettings = 0
   case $msg = $GUI_EVENT_CLOSE
   $are_you_sure_you_want_to_exit = msgbox(1+48+256,"Settings","Please make sure you have saved first")
   if $are_you_sure_you_want_to_exit = 1 Then
   guidelete($settingsgui)
   $guisettings = 0
   EndIf
EndSelect
EndIf
if $blockedprocesses[0] > 0 Then
   $hash3 = 0
   Do
   $hash3 = $hash3 + 1
   if processexists($blockedprocesses[$hash3]) not = 0 Then
   processclose($blockedprocesses[$hash3])
   guictrlsetdata($list,$number & ".) You are not allowed to run: " & $blockedprocesses[$hash3])
   $number = $number + 1
   EndIf
   until $hash3 = $blockedprocesses[0]
EndIf
wend
func scriptexited ()
  sleep(100)
EndFunc

I have replaced the code with sleep(100) incasse it was anything in their causing the problem.

Edited by subzerostig

There are 10 types of people in this world. Those that understand binary, and those that do not

Share this post


Link to post
Share on other sites



Fixed. Incorrect syntax for previous function


There are 10 types of people in this world. Those that understand binary, and those that do not

Share this post


Link to post
Share on other sites

subzerostig,

A quick run with Tidy and you can see that you have your Func...EndFunc structures inside the While...WEnd loop started on line #127 and the Select structure started on line #257. If you place the EndSelect and WEnd correctly around line #586 before you start defining functions then the script passes the Tidy check. ;)

Tidy comes as part of the full SciTE4AutoIt3 package which you can download here - you get lots of goodies to help you code in AutoIt, I really do recommend it. :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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  
Followers 0