Jump to content

Case Else and EndIf error


Recommended Posts

I have this usual GUI thing with a lot of stuff inside but when I try to run it SciTi sais there should be EndIf after Case Else.

I didn't think so but like, you know, I just tried it.

After trying it I got 4 errors instead of one.

Please help me, I've been coding all week on this.

It's for Extreme Cleaner, my award-winning software program.

And I have to get it finished because I've got an interview soon.

http://www.extremecleaner.eu/

Please help me,

Ruben van Os,

15 year old programmer.

Go to This site for my best product!

Link to comment
Share on other sites

and you want somewone to answer a CODEBASED question without code

people will just be able to guess

$totalcleaningtime=TimerDiff($totalcleaningtimestart)/1000/60
            If @OSLang=0413 Or @OSLang=0813 Then
                #Region --- CodeWizard generated code Start ---
        ;MsgBox features: Title=Yes, Text=Yes, Buttons=OK, Icon=Info
                MsgBox(64,"Extreme Cleaner","Computer geoptimaliseerd in "&$totalcleaningtime &" minuten.", 30)
                #EndRegion --- CodeWizard generated code End ---
            Else
                #Region --- CodeWizard generated code Start ---
        ;MsgBox features: Title=Yes, Text=Yes, Buttons=OK, Icon=Info
                MsgBox(64,"Extreme Cleaner","Computer optimized in "&$totalcleaningtime &" minutes.", 30)
                #EndRegion --- CodeWizard generated code End ---
            EndIf
            GUICtrlSetState( $Button_2, $GUI_SHOW )
            GUICtrlSetState( $Button_6, $GUI_SHOW )
            If GUICtrlRead($Checkbox_3)=$GUI_CHECKED Then
                Shutdown(5)
            EndIf
        Case Else
    ;;;
    EndSelect
WEnd
Exit

It's not the full code but I can't disclose the full code.

Edited by Somebody Someware

Go to This site for my best product!

Link to comment
Share on other sites

you have to post the whole Select -> Endselect part.

If you dont want us to see the real code make an example script and replace the cases with something else.

Ok, here it is.

While 1
    $msg = GuiGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $exit
            Exit
        Case $msg = $addremovebackgroundcleaner
            If FileExists(@StartupCommonDir &"\backgroundclean.exe") Then
                FileDelete(@StartupCommonDir &"\backgroundclean.exe")
                #Region --- CodeWizard generated code Start ---
        ;MsgBox features: Title=Yes, Text=Yes, Buttons=OK, Icon=Info
                MsgBox(64,"Extreme Cleaner",$backgroundcleanerdisabled)
                #EndRegion --- CodeWizard generated code End ---
            Else
                FileCopy( @ScriptDir &"\backgroundclean.exe", @StartupCommonDir &"\backgroundclean.exe" )
                #Region --- CodeWizard generated code Start ---
        ;MsgBox features: Title=Yes, Text=Yes, Buttons=OK, Icon=Info
                MsgBox(64,"Extreme Cleaner",$backgroundcleanerenabled)
                #EndRegion --- CodeWizard generated code End ---            
            EndIf
        Case $msg = $Button_6
            GUISetState( @SW_HIDE, $gui_1 )
            GUISetState( @SW_SHOW, $gui_2 )
        Case $msg = $switch
            GUISetState( @SW_HIDE, $gui_2 )
            GUISetState( @SW_SHOW, $gui_1 )
        Case $msg = $Button_2
[indent][/indent][indent][/indent][indent][/indent]HIDDEN CODE HERE
        Case Else
    ;;;
    EndSelect
WEnd
Exit

It gives me the following error:

C:\Program Files\Extreme Cleaner\extremecleaner2150alpha(just started).au3(709,3) : ERROR: missing EndIf.

Case

^

The error is about the rule that reads: Case Else

Edited by Somebody Someware

Go to This site for my best product!

Link to comment
Share on other sites

Ok, here it is.

While 1
    $msg = GuiGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $exit
            Exit
        Case $msg = $addremovebackgroundcleaner
            If FileExists(@StartupCommonDir &"\backgroundclean.exe") Then
                FileDelete(@StartupCommonDir &"\backgroundclean.exe")
                #Region --- CodeWizard generated code Start ---
    ;MsgBox features: Title=Yes, Text=Yes, Buttons=OK, Icon=Info
                MsgBox(64,"Extreme Cleaner",$backgroundcleanerdisabled)
                #EndRegion --- CodeWizard generated code End ---
            Else
                FileCopy( @ScriptDir &"\backgroundclean.exe", @StartupCommonDir &"\backgroundclean.exe" )
                #Region --- CodeWizard generated code Start ---
    ;MsgBox features: Title=Yes, Text=Yes, Buttons=OK, Icon=Info
                MsgBox(64,"Extreme Cleaner",$backgroundcleanerenabled)
                #EndRegion --- CodeWizard generated code End ---            
            EndIf
        Case $msg = $Button_6
            GUISetState( @SW_HIDE, $gui_1 )
            GUISetState( @SW_SHOW, $gui_2 )
        Case $msg = $switch
            GUISetState( @SW_HIDE, $gui_2 )
            GUISetState( @SW_SHOW, $gui_1 )
        Case $msg = $Button_2
[indent][/indent][indent][/indent][indent][/indent]HIDDEN CODE HERE
        Case Else
;;;
    EndSelect
WEnd
Exit

It gives me the following error:

C:\Program Files\Extreme Cleaner\extremecleaner2150alpha(just started).au3(709,3) : ERROR: missing EndIf.

Case

^

The error is about the rule that reads: Case Else

Nothing wrong with that that I can see. Error must be in your hidden code. If you use Scite then use Ctrl T to tidy the code and it will tell you where the errors are.
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

Nothing wrong with that that I can see. Error must be in your hidden code. If you use Scite then use Ctrl T to tidy the code and it will tell you where the errors are.

Tidy gave me this information:

c:\program files\extreme cleaner\extremecleaner2150alpha(just started).au3(712) : ### Tidy Error -> "endselect" is closing previous "case"

c:\program files\extreme cleaner\extremecleaner2150alpha(just started).au3(714) : ### Tidy Error -> "wend" is closing previous "select"

Partial code:

Case Else
            ;;;
;### Tidy Error -> "endselect" is closing previous "case"
        EndSelect
;### Tidy Error -> "wend" is closing previous "select"
    WEnd
    Exit

I still don't get it :S

Go to This site for my best product!

Link to comment
Share on other sites

Tidy gave me this information:

c:\program files\extreme cleaner\extremecleaner2150alpha(just started).au3(712) : ### Tidy Error -> "endselect" is closing previous "case"

c:\program files\extreme cleaner\extremecleaner2150alpha(just started).au3(714) : ### Tidy Error -> "wend" is closing previous "select"

Partial code:

Case Else
        ;;;
;### Tidy Error -> "endselect" is closing previous "case"
        EndSelect
;### Tidy Error -> "wend" is closing previous "select"
    WEnd
    Exit

I still don't get it :S

I removed one rule of code and it works, thank you guys for helping me.

Go to This site for my best product!

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