Jump to content

Weird Errors...


Gaboury
 Share

Recommended Posts

I am making a mIRC Scrim Finder...

But now, I got help in another topic from someone (Valuater) and he gave me a code that should work...I was mixing up functions and guigetmsg etc so he gave me that:

#include <GuiConstants.au3>
Dim $stop = 0, $go = 0, $time = 20;sleep time
;If Not IsDeclared('WS_CLIPSIBLINGS') Then Global $WS_CLIPSIBLINGS = 0x04000000
;-------------------------------------------------------------------------------------------------------------------------------------------------------------- GUI
GuiCreate("mIRC Scrim Auto Searcher", 365, 316,(@DesktopWidth-392)/2, (@DesktopHeight-316)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)

$Picture = GuiCtrlCreatePic("C:\Documents and Settings\Jaimie\Bureau\mircscrim.jpg", 20, 10, 325, 65)
$input1 = GuiCtrlCreateInput(".: 5 vs 5 | East | Yours | Cal-I | MAP | PM ME :.", 130, 85, 215, 22)
GUICtrlSetState( -1, $GUI_FOCUS)
$label1 = GuiCtrlCreateLabel("Hi.  This is my first program.  I made this mIRC Scrim Finder to make it easier to find scrims.  Just paste whatever line you'd have posted on mIRC to find a scrim and then press Start.  It will also log you in the good mIRC server and make sure you don't bypass the flood protection.", 20, 150, 340, 80)
$startbutton = GuiCtrlCreateButton("Start Finding!", 130, 115, 96, 23)
GUICtrlSetState( -1, $GUI_DEFBUTTON)
$stopbutton = GuiCtrlCreateButton("Stop Finding!", 249, 115, 96, 23)
$progress = GUICtrlCreateProgress( 20, 116, 96, 20)
GUISetState()
;-------------------------------------------------------------------------------------------------------------------------------------------------------------- GUI END
;Set on event-- does not use GUIGetMessage()
Opt("GUIOnEventMode", 1); Change to OnEvent mode

GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")
GUICtrlSetOnEvent($startbutton, "startit")
GUICtrlSetOnEvent($stopbutton, "stopit")

;-------------------------------------------------------------------------------------------------------------------------- end set on event

While 1
    
    If $go = 1 Then
        While 2
            $inputread = GUICtrlRead($input1)
            $surebox = MsgBox(4, "Are you sure?", "Is this really the text you want to enter?   " & $inputread )
            If $surebox = 6 Then
                msgbox(0, "Accepted.", "mIRC should start searching for a scrim within 30 seconds or so.  This window will close itself automatically.", 3)
            ElseIf $surebox = 7 Then
                MsgBox(0, "Canceled.", "The search was canceled.  Please change your input and press Start Finding again.  This window will close itself automatically.", 3)
            ExitLoop
            $iniread = IniRead(@HomeDrive & "\mIRCScrimFinder\config.ini", "Path", "$mircpath", "NotFound")
            If Not $iniread = "NotFound" Then
                Call("mircstart")
                Run($iniread)
            ElseIf $iniread = "NotFound" Then
            GUICtrlSetData($progress, 10)
            MsgBox(0, "Detecting...", "Now searching the path to your mIRC executable.", 2)
            GUICtrlSetData($progress, 20)
            Sleep($time)
            If $stop = 1 then ExitLoop
            Sleep(1000)
            GUICtrlSetData($progress, 30)
            Sleep($time)
            If $stop = 1 then ExitLoop
            runWait(@comspec & ' /c dir /b /s ' & @HomeDrive & '\mirc.exe > "' & @HomeDrive & '\result.txt"', @HomeDrive, @SW_HIDE)
            GUICtrlSetData($progress, 60)
            Sleep($time)
            If $stop = 1 then ExitLoop
            $resultopen = FileOpen(@HomeDrive & "\result.txt", 0 )
            GUICtrlSetData($progress, 70)
            Sleep($time)
            If $stop = 1 then ExitLoop
            $resultread = FileReadLine($resultopen)
            GUICtrlSetData($progress, 80)
            Sleep($time)
            If $stop = 1 then ExitLoop
            FileClose($resultopen)
            DirCreate (@HomeDrive & "\mIRCScrimFinder\")
            GUICtrlSetData($progress, 90)
            Sleep($time)
            If $stop = 1 then ExitLoop
            IniWrite(@homeDrive & "\mIRCScrimFinder\config.ini", "Path", "$mircpath", $resultread)
            GUICtrlSetData($progress, 100)
            Sleep($time)
            If $stop = 1 then ExitLoop
            MsgBox(0, "Detected.", "mIRC Scrim Finder detected the path to your mIRC executable." & @CRLF & "The starting is now only a question of seconds.", 2)
            ExitLoop
        EndIf
        WEnd
    $go = 0
    EndIf

    If $stop = 1 Then
        MsgBox(0, "Cancelled", "Search was cancelled...", 2)
        GUICtrlSetData($progress, 0)
        $stop = 0
    EndIf
    
    Sleep(100)
WEnd

Func stopit()
   $stop = 1
EndFunc

Func startit()
    $go = 1
Endfunc

Func CLOSEClicked()
  MsgBox(0, "Close Program", "You clicked CLOSE!" & @CRLF & "   Now Exiting...", 3)
  Exit
EndFunc

So now, that works perfectly. (Well, now the part that involve mIRC, ain't there yet ;p) But then, whenever I try to add anything in the code, it gives me some weird error...

It always says me "Wend statement has no matching While statement"... so then I remove it, and it says "While statement has no matching wend statement"... I put back the Wend and it says the first error, etc... But I didn't even modify the part with the Wend, I modified the middle part!

Here is the script I remade entirely basing myself on the one above, but it didn't change anything as it still gives me the same f*cking error :@

#include <GuiConstants.au3>
Dim $stop = 0, $start = 0, $time = 20;sleep time
;If Not IsDeclared('WS_CLIPSIBLINGS') Then Global $WS_CLIPSIBLINGS = 0x04000000
;------------------------------------------------------------------------------------------------------------------------------------------ GUI
GuiCreate("mIRC Scrim Auto Searcher", 365, 316,(@DesktopWidth-392)/2, (@DesktopHeight-316)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)

$Picture = GuiCtrlCreatePic("C:\Documents and Settings\Jaimie\Bureau\Jaimie\AutoIt\mIRC Automatic Scrim Searcher\mircscrim.jpg", 20, 10, 325, 65)
$input1 = GuiCtrlCreateInput(".: 5 vs 5 | East | Yours | Cal-I | MAP | PM ME :.", 20, 85, 325, 22)
GUICtrlSetState( -1, $GUI_FOCUS)
$label1 = GuiCtrlCreateLabel("Hi.  This is my first program.  I made this mIRC Scrim Finder to make it easier to find scrims.  Just paste whatever line you'd have posted on mIRC to find a scrim and then press Start.  It will also log you in the good mIRC server and make sure you don't bypass the flood protection.", 20, 150, 340, 80)
$startbutton = GuiCtrlCreateButton("Start Finding!", 130, 115, 96, 23)
GUICtrlSetState( -1, $GUI_DEFBUTTON)
$stopbutton = GuiCtrlCreateButton("Stop Finding!", 249, 115, 96, 23)
$progress = GUICtrlCreateProgress( 20, 116, 96, 20)
GUISetState() 
;------------------------------------------------------------------------------------------------------------------------------------------ GUI
;------------------------------------------------------------------------------------------------------------------------------------------ Set On Event
Opt("GUIOnEventMode", 1); Gui On Event ON

GUICtrlSetOnEvent($startbutton, "startit")
GUICtrlSetOnEvent($stopbutton, "stopit")
GUISetOnEvent($GUI_EVENT_CLOSE, "Closeit")
;------------------------------------------------------------------------------------------------------------------------------------------ Set On Event
;------------------------------------------------------------------------------------------------------------------------------------------ Functions
While 1
    If $start = 1 Then
        While 2
                        $getinput = GUICtrlRead($input1)
                        $askbox1 = MsgBox(4, "Are you sure?", "Are those informations about the scrim needed the good ones?" & @CRLF & $getinput)
                    If $askbox1 = 7 Then
                        MsgBox(0, "Canceled", "The search has been canceled.  Please rectify the informations and search again.", 3)
                        ExitLoop
                    ElseIf $askbox1 = 6 Then
                        MsgBox(0, "Info", "The scrim information has been accepted.  Please be patient while mIRC Scrim Finder tries to find your scrim.", 3)
                        $readiniconfig = IniRead(@HomeDrive & "\mIRCScrimFinder\config.ini", "Path", "$mircpath", "NotFound")
                    If Not $readiniconfig = "NotFound" Then
                        Run($readiniconfig)
                        Call("mircstart")
                    ElseIf $readiniconfig = "NotFound" Then
                        GUICtrlSetData($progress, 10)
                        MsgBox(0, "Info", "Please wait as we find your mIRC executable" & @CRLF & "Note that this will only happen the first time you launch this program.", 5)
                        GUICtrlSetData($progress, 20)
                        Sleep($time)
                    If $stop = 1 Then ExitLoop
                        Sleep(1000)
                        GUICtrlSetData($progress, 30)
                        Sleep($time)
                    If $stop = 1 Then ExitLoop
                        runWait(@comspec & ' /c dir /b /s ' & @HomeDrive & '\mirc.exe > "' & @HomeDrive & '\result.txt"', @HomeDrive, @SW_HIDE)
                        GUICtrlSetData($progress, 60)
                        Sleep($time)
                    If $stop = 1 Then ExitLoop
                        $resultopen = FileOpen(@HomeDrive & "\result.txt", 0 )
                        GUICtrlSetData($progress, 70)
                        Sleep($time)
                    If $stop = 1 then ExitLoop
                        $resultread = FileReadLine($resultopen)
                        GUICtrlSetData($progress, 80)
                        Sleep($time)
                    If $stop = 1 then ExitLoop
                        FileClose($resultopen)
                        DirCreate (@HomeDrive & "\mIRCScrimFinder\")
                        GUICtrlSetData($progress, 90)
                        Sleep($time)
                    If $stop = 1 then ExitLoop
                        IniWrite(@homeDrive & "\mIRCScrimFinder\config.ini", "Path", "$mircpath", $resultread)
                        GUICtrlSetData($progress, 100)
                        Sleep($time)
                    If $stop = 1 then ExitLoop
                        MsgBox(0, "Detected.", "mIRC Scrim Finder detected the path to your mIRC executable." & @CRLF & "The starting is now only a question of seconds.", 2)
                        ExitLoop
                    EndIf
            
Func startit()
    $start = 1
EndFunc

Func stopit()
    $stop = 1
EndFunc

Func closeit()
    MsgBox(0, "Closing...", "You clicked the Quit button." & @CRLF &   "     Now Exiting...", 3)
    Exit
EndFunc

If I put a Wend right before "Func startit()", then it says there is no While matching statement...and if I don't put any, it says that there is no Wend statement and give "Fuck startit" as the line in the error message...

Any ideas? :/

Note: I am new to Autoit, so please bare with me...Also, if you guys could explain why you would do something it would help a lot because I wanna understand :whistle:.

Thanks :dance:

- Gaboury.

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...