Drew Posted May 2, 2008 Share Posted May 2, 2008 The code should not essentially be working yet, its just a base code that is unfinished but it is getting the error and we cannot figure out why its coming up. Here's the script: expandcollapse popup#Include <Array.au3> ;~ HotKeySet('!c', '_Test'); Set up an A hotkey to send the message HotKeySet('!n', '_MsgBox') Dim $iMainSocket = 0 Dim $iConnectedSocket = -1 Dim $sData = "" global $array[1000]=[0] $array[0]=0 TCPStartup() $iMainSocket = TCPListen(@IPAddress1,7000) ;$array[$array[0]] = $iConnectedSocket While 1 for $i=1 to $array[0] If $iConnectedSocket >= 0 Then $IP = TCPRecv($iConnectedSocket, 1024) If @error Then $array[$i] = -1 If $array[$i] >= 0 Then $sData = TCPRecv($array[$i],1024) $IP = TCPRecv($array[$i], 1024) If @error Then $array[$i] = "disconnected" ConsoleWrite("Client has disconnected" & @CRLF) endif ElseIf $IP Then IniWrite(@DesktopDir&"\Logs\IP.ini", $IP, $iConnectedSocket, "Array") EndIf endif Else $array[0]=$array[0]+1 $array[$i] = TCPAccept($iMainSocket) If $array[$i] >= 0 Then TcpSend($array[$i], "$sIP") if not @error then ConsoleWrite("Connection established" & @CRLF) Else $array[$i]="disconnected" EndIf EndIf EndIf next Wend Func _MsgBox() TcpSend($iConnectedSocket, "$sIP") EndFunc We're both tired , but regardless we can't see whats wrong with the code. If someone with a fresh mind could look it over I would be grateful. Regards, Link to comment Share on other sites More sharing options...
BrettF Posted May 2, 2008 Share Posted May 2, 2008 The code should not essentially be working yet, its just a base code that is unfinished but it is getting the error and we cannot figure out why its coming up. Here's the script: expandcollapse popup#Include <Array.au3> ;~ HotKeySet('!c', '_Test'); Set up an A hotkey to send the message HotKeySet('!n', '_MsgBox') Dim $iMainSocket = 0 Dim $iConnectedSocket = -1 Dim $sData = "" global $array[1000]=[0] $array[0]=0 TCPStartup() $iMainSocket = TCPListen(@IPAddress1,7000) ;$array[$array[0]] = $iConnectedSocket While 1 for $i=1 to $array[0] If $iConnectedSocket >= 0 Then $IP = TCPRecv($iConnectedSocket, 1024) If @error Then $array[$i] = -1 If $array[$i] >= 0 Then $sData = TCPRecv($array[$i],1024) $IP = TCPRecv($array[$i], 1024) If @error Then $array[$i] = "disconnected" ConsoleWrite("Client has disconnected" & @CRLF) endif ElseIf $IP Then IniWrite(@DesktopDir&"\Logs\IP.ini", $IP, $iConnectedSocket, "Array") EndIf endif Else $array[0]=$array[0]+1 $array[$i] = TCPAccept($iMainSocket) If $array[$i] >= 0 Then TcpSend($array[$i], "$sIP") if not @error then ConsoleWrite("Connection established" & @CRLF) Else $array[$i]="disconnected" EndIf EndIf EndIf next Wend Func _MsgBox() TcpSend($iConnectedSocket, "$sIP") EndFunc We're both tired , but regardless we can't see whats wrong with the code. If someone with a fresh mind could look it over I would be grateful. Regards,What type of error is it? Is it in SciTe? Does a msg box pop up when the script runs? WTF is the error? Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
Drew Posted May 2, 2008 Author Share Posted May 2, 2008 Lol That would help huh... Sorry , as I said. I'm pretty tired. [.......]\Server_Side.au3 (30) : ==> "Else" statement with no matching "If" statement.: Else Link to comment Share on other sites More sharing options...
Drew Posted May 2, 2008 Author Share Posted May 2, 2008 (edited) Now I'm getting this one. ( No change to the script has been made. ) [.....]\Server_Side.au3(30,3) : ERROR: missing Next. EDIT Full list of errors: >C:\Program Files\AutoIt3\SciTE\..\au3check.exe "C:\Documents and Settings\Administrator\Desktop\Dreu's Server-Side Prog Work\Server_Side.au3" AutoIt3 Syntax Checker v1.54.8 Copyright © Tylo 2007 C:\Documents and Settings\Administrator\Desktop\Dreu's Server-Side Prog Work\Server_Side.au3(30,3) : ERROR: missing Next. Else ^ C:\Documents and Settings\Administrator\Desktop\Dreu's Server-Side Prog Work\Server_Side.au3(15,14) : REF: missing Next. For $i=1 to ~~~~~~~~~~~~~^ C:\Documents and Settings\Administrator\Desktop\Dreu's Server-Side Prog Work\Server_Side.au3(30,3) : ERROR: missing Wend. Else ^ C:\Documents and Settings\Administrator\Desktop\Dreu's Server-Side Prog Work\Server_Side.au3(14,1) : REF: missing Wend. While ^ C:\Documents and Settings\Administrator\Desktop\Dreu's Server-Side Prog Work\Server_Side.au3(30,3) : ERROR: syntax error Else ^ C:\Documents and Settings\Administrator\Desktop\Dreu's Server-Side Prog Work\Server_Side.au3(3,26) : ERROR: _MsgBox(): undefined function. HotKeySet('!n', '_MsgBox') ~~~~~~~~~~~~~~~~~~~~~~~~~^ Edited May 2, 2008 by Drew Link to comment Share on other sites More sharing options...
therks Posted May 2, 2008 Share Posted May 2, 2008 I believe this section of code is mucking up on you. If $array[$i] >= 0 Then $sData = TCPRecv($array[$i],1024) $IP = TCPRecv($array[$i], 1024) If @error Then $array[$i] = "disconnected" ConsoleWrite("Client has disconnected" & @CRLF) endif ElseIf $IP Then IniWrite(@DesktopDir&"\Logs\IP.ini", $IP, $iConnectedSocket, "Array") EndIf You can't have If..Else if you put anything after the Then on the same line. Just separate that first line into two. My AutoIt Stuff | My Github Link to comment Share on other sites More sharing options...
MerkurAlex Posted May 2, 2008 Share Posted May 2, 2008 (edited) I believe this section of code is mucking up on you. If $array[$i] >= 0 Then $sData = TCPRecv($array[$i],1024) $IP = TCPRecv($array[$i], 1024) If @error Then $array[$i] = "disconnected" ConsoleWrite("Client has disconnected" & @CRLF) endif ElseIf $IP Then IniWrite(@DesktopDir&"\Logs\IP.ini", $IP, $iConnectedSocket, "Array") EndIf You can't have If..Else if you put anything after the Then on the same line. Just separate that first line into two.That is not the problem with our code... All of the else's and elseif's have matching if's there shouldn't be a problem.. Edited May 2, 2008 by MerkurAlex [quote name='PsaltyDS' post='635433' date='Jan 27 2009, 07:04 AM']Larry is a mass murderer?! It's always the quiet, clean cut, bald guys... [/quote] Link to comment Share on other sites More sharing options...
Developers Jos Posted May 2, 2008 Developers Share Posted May 2, 2008 Run tidy which gives: expandcollapse popup#Tidy_Parameters=/rel 1 #include <Array.au3> ;~ HotKeySet('!c', '_Test'); Set up an A hotkey to send the message HotKeySet('!n', '_MsgBox') Dim $iMainSocket = 0 Dim $iConnectedSocket = -1 Dim $sData = "" Global $array[1000] = [0] $array[0] = 0 TCPStartup() $iMainSocket = TCPListen(@IPAddress1, 7000) ;$array[$array[0]] = $iConnectedSocket While 1 For $i = 1 To $array[0] If $iConnectedSocket >= 0 Then $IP = TCPRecv($iConnectedSocket, 1024) If @error Then $array[$i] = -1 If $array[$i] >= 0 Then $sData = TCPRecv($array[$i], 1024) $IP = TCPRecv($array[$i], 1024) If @error Then $array[$i] = "disconnected" ConsoleWrite("Client has disconnected" & @CRLF) EndIf ElseIf $IP Then IniWrite(@DesktopDir & "\Logs\IP.ini", $IP, $iConnectedSocket, "Array") EndIf EndIf ;### Tidy Error -> "else" is closing previous "for" Else $array[0] = $array[0] + 1 $array[$i] = TCPAccept($iMainSocket) If $array[$i] >= 0 Then TCPSend($array[$i], "$sIP") If Not @error Then ConsoleWrite("Connection established" & @CRLF) Else $array[$i] = "disconnected" EndIf EndIf ;### Tidy Error -> "endif" is closing previous "for" EndIf ;### Tidy Error -> "next" is closing previous "while" Next ;### Tidy Error: next line creates a negative tablevel. ;### Tidy Error: next line creates a negative tablevel for the line after it. WEnd Func _MsgBox() TCPSend($iConnectedSocket, "$sIP") EndFunc ;==>_MsgBox SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
James Posted May 2, 2008 Share Posted May 2, 2008 Drew, you don't need to keep making topics, just have one which will hold all of your problems. Much easier and that way it's easier to see what help you have had and what has changed in your code Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
Drew Posted May 2, 2008 Author Share Posted May 2, 2008 Same errors. Link to comment Share on other sites More sharing options...
Developers Jos Posted May 2, 2008 Developers Share Posted May 2, 2008 Same errors.What same error ?Did you change anything ? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
MerkurAlex Posted May 2, 2008 Share Posted May 2, 2008 What same error ?Did you change anything ?No he tried that Tidy code or something we were unable to find out what was wrong so i rewrote the code for him... [quote name='PsaltyDS' post='635433' date='Jan 27 2009, 07:04 AM']Larry is a mass murderer?! It's always the quiet, clean cut, bald guys... [/quote] Link to comment Share on other sites More sharing options...
Developers Jos Posted May 2, 2008 Developers Share Posted May 2, 2008 No he tried that Tidy code or something we were unable to find out what was wrong so i rewrote the code for him...I think when posts are made that pinpoint what the problem is in the script, the OP could at least put in a bit of effort to try to understand and do something with it in stead of posting as he did in his last post.my 2 cents SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Drew Posted May 2, 2008 Author Share Posted May 2, 2008 (edited) I did try , alot. But it's very difficult trying to correct a problem when you can't find the problem. I looked over that script countless countless times and could never find anything to correct. Do you see anything wrong with it that would produce errors? ...me either. But I also tried the Tidy thing you suggested. I was just letting you know that didn't work either. Regardless , thank you for replying. Edited May 2, 2008 by Drew Link to comment Share on other sites More sharing options...
MerkurAlex Posted May 2, 2008 Share Posted May 2, 2008 (edited) I think when posts are made that pinpoint what the problem is in the script, the OP could at least put in a bit of effort to try to understand and do something with it in stead of posting as he did in his last post.my 2 cents I have been talking to him on MSN alot and helping him he is trying to understand alot and is for that matter im just helping him along and i rewrote this cause i needed it also he did not ask me to rewrite it for him at all im just helping a friend and myself at the same time....my 2 cents Edited May 2, 2008 by MerkurAlex [quote name='PsaltyDS' post='635433' date='Jan 27 2009, 07:04 AM']Larry is a mass murderer?! It's always the quiet, clean cut, bald guys... [/quote] Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted May 2, 2008 Moderators Share Posted May 2, 2008 I did try , alot. But it's very difficult trying to correct a problem when you can't find the problem. I looked over that script countless countless times and could never find anything to correct. Do you see anything wrong with it that would produce errors?...me either.But I also tried the Tidy thing you suggested. I was just letting you know that didn't work either.Regardless , thank you for replying.Actually, just looking at Jos's tidy of your script, I can't see how you say it "didn't" help.It clearly shows you put an EndIf above an Else with no matching If for the Else.Thus cutting off the For/Next Loop. If you removed the EndIf above the Else (where you see the Tidy error of course), you'd see your problem go away.Here's a suggestion if you are dead set against using Tidy for whatever insane reason. When you get errors like that, count the EndIf/WEnd/Next/etc... to see if they match the number of starting "If (not closed on one line of course)/While/For/etc..." statements.In your case, you have 5 open "If" statements, with 6 closing "EndIf" statements Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Developers Jos Posted May 2, 2008 Developers Share Posted May 2, 2008 I did try , alot. But it's very difficult trying to correct a problem when you can't find the problem. I looked over that script countless countless times and could never find anything to correct. Do you see anything wrong with it that would produce errors?...me either.But I also tried the Tidy thing you suggested. I was just letting you know that didn't work either.Regardless , thank you for replying.It is not a matter about just trying, but also about communicating what you tried and what your problem still is.The output of Tidy really Clearly explains your problem and you need to start at the first reported error.The script is your logic so its you that should understand where that ELSE belongs that is at the wrong place.It will not help you when I correct your code for you because that would not help you for the future, so look at your script and see what the issues are reported by Tidy and solve them One at a time. Don;t forget to run Tidy again after making Each change.Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Drew Posted May 2, 2008 Author Share Posted May 2, 2008 I had the wrong idea on how Tidy worked. I apologize. 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