Jump to content
Sign in to follow this  
Gaboury

Weird Errors...

Recommended Posts

Gaboury

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.

Share this post


Link to post
Share on other sites
Somerset

$a=1
while 1
if $a = 0 then
else
wend

run the above it will give you a wend error. it is missing Endif. go figure try adding some endif somewhere it might help.


 

Spoiler

shoot_zpsfd329d66.png
dontbelieveeverythingyouthink_zps0e1e900

Madness is the first step to understanding...

Share this post


Link to post
Share on other sites
Gaboury

Thanks :whistle: I'll post when I have the answer!

By the way, do you have msn? It would be so much better when I have questions :/ If you wanna give me I would be so happy :dance:

Share this post


Link to post
Share on other sites
Gaboury

I added endif just before the wend:

$a=1
while 1
if $a = 0 then
else
endif
wend

I tried adding some endif in my script and it never did anything :/ Another clue maybe? :whistle:

Share this post


Link to post
Share on other sites
Gaboury

Yeah I got it! I ad to put

Wend

Endif

Wend :dance:

Thanks a lot buddy :whistle: I love it when people help me like that, I learn and I don't just copy their work :(

Thanks buddy :D I luv ya! :dance:

- Gaboury!!!

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  

×