Jump to content

Error Troubles


Recommended Posts

OK, when ever i run this script, autoit says that there is an error with one of my Wend statments, and that there is no matching While statement, but, the script is perfectly fine :think: (I think)!

Could someone check this out because it is bothering me.... :(

$g_IP = "127.0.0.1"


TCPStartUp()


Global $socket = TCPConnect( $g_IP, 4931 )
If $socket = -1 Then Exit


;Get Commands
;==============================================
while 1
$recv = TCPRecv( $ConnectedSocket, 9999999999999999 )

If $recv <> "" Then
    if $recv = "Connected" then
    MsgBox(64,"History Peeker","Successfuly Connected To Client")
    Dim $iMsgBoxAnswer
$iMsgBoxAnswer = MsgBox(68,"History Peeker","Would You Like To Download Their Online History Records?")
Select
   Case $iMsgBoxAnswer = 6;Yes
getit()
   Case $iMsgBoxAnswer = 7;No
exit
EndSelect
    endif
endif
If $ConnectedSocket <> -1 Then 
TCPCloseSocket( $Socket )
exit
endif
wend

;InputBox ( "title", "Prompt" [, "Default" [, "password char" [, Width, Height [, Left, Top [, TimeOut]]]]] )
func getit()
SplashTextOn ( "Wait", "Please Wait..." & @CRLF & @CRLF & "Asking Server For Records..." , 250 , 100 , -1, -1, 1)

while 1
while 1
$recv = TCPRecv( $ConnectedSocket, 9999999999999999 )

If $recv <> "" Then
    if $recv = "Starting" then
SplashTextOn ( "Wait", "Please Wait..." & @CRLF & @CRLF & "Server Is Preparing Records (This Could Take A Minute)..." , 250 , 100 , -1, -1, 1)
exitloop
endif
If $ConnectedSocket <> -1 Then 
TCPCloseSocket( $Socket )
exit
endif
wend





while 1 = 1
$recv = TCPRecv( $ConnectedSocket, 9999999999999999 )

If $recv <> "" Then
    if $recv = "Sending History" then
SplashTextOn ( "Wait", "Please Wait..." & @CRLF & @CRLF & "Server Is Sending The Records (This Could Take A Minute)..." , 250 , 100 , -1, -1, 1)
exitloop
endif
If $ConnectedSocket <> -1 Then 
TCPCloseSocket( $Socket )
exit
endif
wend

while 1
$recv = TCPRecv( $ConnectedSocket, 9999999999999999 )

If $recv <> "" Then
$file = FileOpen ( "C:\history.txt", 2 )
FileWrite ( $file, $recv )
fileclose($file)
exitloop
endif
If $ConnectedSocket <> -1 Then 
TCPCloseSocket( $Socket )
exit
endif
wend
splashoff()
endfunc

See, im pretty sure there are NO errors. Try pasting it into your copy of autoit and see... :)

Link to comment
Share on other sites

I use SciTE with Tidy, you'll see where the problem starts

TCPStartup()


Global $socket = TCPConnect($g_IP, 4931)
If $socket = -1 Then Exit


;Get Commands
;==============================================
While 1
    $recv = TCPRecv($ConnectedSocket, 9999999999999999)
    
    If $recv <> "" Then
        If $recv = "Connected" Then
            MsgBox(64, "History Peeker", "Successfuly Connected To Client")
            Dim $iMsgBoxAnswer
            $iMsgBoxAnswer = MsgBox(68, "History Peeker", "Would You Like To Download Their Online History Records?")
            Select
                Case $iMsgBoxAnswer = 6;Yes
                    getit()
                Case $iMsgBoxAnswer = 7;No
                    Exit
            EndSelect
        EndIf
    EndIf
    If $ConnectedSocket <> - 1 Then
        TCPCloseSocket($socket)
        Exit
    EndIf
WEnd

;InputBox ( "title", "Prompt" [, "Default" [, "password char" [, Width, Height [, Left, Top [, TimeOut]]]]] )
Func getit()
    SplashTextOn("Wait", "Please Wait..." & @CRLF & @CRLF & "Asking Server For Records...", 250, 100, -1, -1, 1)
    
    While 1
        While 1
            $recv = TCPRecv($ConnectedSocket, 9999999999999999)
            
            If $recv <> "" Then
                If $recv = "Starting" Then
                    SplashTextOn("Wait", "Please Wait..." & @CRLF & @CRLF & "Server Is Preparing Records (This Could Take A Minute)...", 250, 100, -1, -1, 1)
                    ExitLoop
                EndIf
                If $ConnectedSocket <> - 1 Then
                    TCPCloseSocket($socket)
                    Exit
                EndIf
;### Tidy Error: Level error -> wend is closing previous If
            WEnd
            
            
            
            
            
            While 1 = 1
                $recv = TCPRecv($ConnectedSocket, 9999999999999999)
                
                If $recv <> "" Then
                    If $recv = "Sending History" Then
                        SplashTextOn("Wait", "Please Wait..." & @CRLF & @CRLF & "Server Is Sending The Records (This Could Take A Minute)...", 250, 100, -1, -1, 1)
                        ExitLoop
                    EndIf
                    If $ConnectedSocket <> - 1 Then
                        TCPCloseSocket($socket)
                        Exit
                    EndIf
;### Tidy Error: Level error -> wend is closing previous If
                WEnd
                
                While 1
                    $recv = TCPRecv($ConnectedSocket, 9999999999999999)
                    
                    If $recv <> "" Then
                        $file = FileOpen("C:\history.txt", 2)
                        FileWrite($file, $recv)
                        FileClose($file)
                        ExitLoop
                    EndIf
                    If $ConnectedSocket <> - 1 Then
                        TCPCloseSocket($socket)
                        Exit
                    EndIf
                WEnd
                SplashOff()
;### Tidy Error: Level error -> endfunc is closing previous while
            EndFunc  ;==>getit

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

oh, thanks. Im on dialup so i cant download SCIte, otherwise i thinki i should. should i fix thoes errors? will that fix it?

EDIT:

You know what? i should be more greatful for your help! Thanks soo much! It really helps. Thanks again.

Edited by spyrorocks
Link to comment
Share on other sites

HI,

try...

$g_IP = "127.0.0.1"


TCPStartup()


Global $socket = TCPConnect($g_IP, 4931)
If $socket = -1 Then Exit
Dim $ConnectedSocket = ''

;Get Commands
;==============================================
While 1
    $recv = TCPRecv($ConnectedSocket, 9999999999999999)
    
    If $recv <> "" Then
        If $recv = "Connected" Then
            MsgBox(64, "History Peeker", "Successfuly Connected To Client")
            Dim $iMsgBoxAnswer
            $iMsgBoxAnswer = MsgBox(68, "History Peeker", "Would You Like To Download Their Online History Records?")
            Select
                Case $iMsgBoxAnswer = 6;Yes
                    getit()
                Case $iMsgBoxAnswer = 7;No
                    Exit
            EndSelect
        EndIf
    EndIf
    If $ConnectedSocket <> - 1 Then
        TCPCloseSocket($socket)
        Exit
    EndIf
WEnd

;InputBox ( "title", "Prompt" [, "Default" [, "password char" [, Width, Height [, Left, Top [, TimeOut]]]]] )
Func getit()
    SplashTextOn("Wait", "Please Wait..." & @CRLF & @CRLF & "Asking Server For Records...", 250, 100, -1, -1, 1)
    
    While 1
        While 1
            $recv = TCPRecv($ConnectedSocket, 9999999999999999)
            
            If $recv <> "" Then
                If $recv = "Starting" Then
                    SplashTextOn("Wait", "Please Wait..." & @CRLF & @CRLF & "Server Is Preparing Records (This Could Take A Minute)...", 250, 100, -1, -1, 1)
                    ExitLoop
                EndIf
                If $ConnectedSocket <> - 1 Then
                    TCPCloseSocket($socket)
                    Exit
                EndIf
            EndIf
        WEnd
        
        
        
        
        
        While 1
            $recv = TCPRecv($ConnectedSocket, 9999999999999999)
            If $recv <> "" Then
                If $recv = "Sending History" Then
                    SplashTextOn("Wait", "Please Wait..." & @CRLF & @CRLF & "Server Is Sending The Records (This Could Take A Minute)...", 250, 100, -1, -1, 1)
                    ExitLoop
                EndIf
                If $ConnectedSocket <> - 1 Then
                    TCPCloseSocket($socket)
                    Exit
                EndIf
            EndIf
        WEnd
        
        While 1
            $recv = TCPRecv($ConnectedSocket, 9999999999999999)
            If $recv <> "" Then
                $file = FileOpen("C:\history.txt", 2)
                FileWrite($file, $recv)
                FileClose($file)
                ExitLoop
            EndIf
            If $ConnectedSocket <> - 1 Then
                TCPCloseSocket($socket)
                Exit
            EndIf
        WEnd
        SplashOff()
    WEnd
EndFunc  ;==>getit

So long,

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

oh, thanks. Im on dialup so i cant download SCIte, otherwise i thinki i should. should i fix thoes errors? will that fix it?

EDIT:

You know what? i should be more greatful for your help! Thanks soo much! It really helps. Thanks again.

there were a couple of endif's missing and a wend

TCPStartup()


Global $socket = TCPConnect($g_IP, 4931)
If $socket = -1 Then Exit


;Get Commands
;==============================================
While 1
    $recv = TCPRecv($ConnectedSocket, 9999999999999999)
    
    If $recv <> "" Then
        If $recv = "Connected" Then
            MsgBox(64, "History Peeker", "Successfuly Connected To Client")
            Dim $iMsgBoxAnswer
            $iMsgBoxAnswer = MsgBox(68, "History Peeker", "Would You Like To Download Their Online History Records?")
            Select
                Case $iMsgBoxAnswer = 6;Yes
                    getit()
                Case $iMsgBoxAnswer = 7;No
                    Exit
            EndSelect
        EndIf
    EndIf
    If $ConnectedSocket <> - 1 Then
        TCPCloseSocket($socket)
        Exit
    EndIf
WEnd

;InputBox ( "title", "Prompt" [, "Default" [, "password char" [, Width, Height [, Left, Top [, TimeOut]]]]] )
Func getit()
    SplashTextOn("Wait", "Please Wait..." & @CRLF & @CRLF & "Asking Server For Records...", 250, 100, -1, -1, 1)
    
    While 1
        While 1
            $recv = TCPRecv($ConnectedSocket, 9999999999999999)
            
            If $recv <> "" Then
                If $recv = "Starting" Then
                    SplashTextOn("Wait", "Please Wait..." & @CRLF & @CRLF & "Server Is Preparing Records (This Could Take A Minute)...", 250, 100, -1, -1, 1)
                    ExitLoop
                EndIf
                If $ConnectedSocket <> - 1 Then
                    TCPCloseSocket($socket)
                    Exit
                EndIf
            EndIf
        WEnd
        
        
        
        
        
        While 1 = 1
            $recv = TCPRecv($ConnectedSocket, 9999999999999999)
            
            If $recv <> "" Then
                If $recv = "Sending History" Then
                    SplashTextOn("Wait", "Please Wait..." & @CRLF & @CRLF & "Server Is Sending The Records (This Could Take A Minute)...", 250, 100, -1, -1, 1)
                    ExitLoop
                EndIf
                If $ConnectedSocket <> - 1 Then
                    TCPCloseSocket($socket)
                    Exit
                EndIf
            EndIf
        WEnd
        
        While 1
            $recv = TCPRecv($ConnectedSocket, 9999999999999999)
            
            If $recv <> "" Then
                $file = FileOpen("C:\history.txt", 2)
                FileWrite($file, $recv)
                FileClose($file)
                ExitLoop
            EndIf
            If $ConnectedSocket <> - 1 Then
                TCPCloseSocket($socket)
                Exit
            EndIf
        WEnd
    WEnd
    SplashOff()
EndFunc  ;==>getit

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...