Jump to content

EndSelect Error on running script....


hispeed_mike
 Share

Recommended Posts

Getting and EndSelect error in the output of Scite...

"EndSelect" statement with no matching "Select" statement.:

Can someone maybe provide fresh eyes, I have gone through the Select statements and as I see it they all match up. Don't know if the way I coded this was correct with so many loops going on etc.

Advise is really appreciated...

Thanks in advance...

#include <Process.au3>
#include <ControlSendPlus.au3>
#include <GUIConstants.au3>
#include <GUIConstantsEx.au3>
#include <GuiButton.au3>
#include <WindowsConstants.au3>
#include <file.au3>
#Include <Array.au3>
;#include "DirCopyProgress.au3"
;#include "FileCopyProgress.au3"
;#include "Zip.au3"
#include "HSLinksys_WAG54G2.au3"
#include "HSLinksys_610N.au3"
#include "HSLinksys_610N_V2.au3"
#include "HSLinksys_WRT54GL.au3"
Dim $WAG120NVisible, $WAG120NSiteLabel, $WAG120NSiteInput, $WAG120NUserLabel, $WAG120NUserInput,  $WAG120NPassLabel, $WAG120NPassInput, $WAG120NPassInput, $buttonchange
 
$bfgui1 = GUICreate ("Network Device Setup", "400", "350")
GUISetState (@SW_HIDE)
GUICtrlCreateLabel ("Select what you are configuring::", 5, 7)
$radio1 = GUICtrlCreateRadio("Printers", 10, 25, 80, 20)
$radio2 = GUICtrlCreateRadio("Power Rebooter", 100, 25, 120, 20)
$radio3 = GUICtrlCreateRadio("Routers & Modems", 220, 25, 120, 20)
;GUICtrlCreateCombo ("Select the Device you are configuring", 100, 5, 210)
;GUICtrlSetData(-1, "NETPRINT 10.10.10.199|NETPRINT1 10.10.10.198|NETPRINT2 10.10.10.197|NETPRINT3 10.10.10.196|NETPRINT4 10.10.10.195|NETPRINT5 10.10.10.194","")
$OK = GUICtrlCreateButton ("Next", 325, 320, 70)
$printgroup = GUICtrlCreateGroup("Printer Setup", 5, 50, 390, 265)
$printcombolabel = GUICtrlCreateLabel ("Printer to Configure", 15, 72)
$printcombo = GUICtrlCreateCombo ("", 125, 70, 210)
$printcombodata = GUICtrlSetData(-1, "NETPRINT 10.10.10.199|NETPRINT1 10.10.10.198|NETPRINT2 10.10.10.197|NETPRINT3 10.10.10.196|NETPRINT4 10.10.10.195|NETPRINT5 10.10.10.194","")
$printsitelabel = GUICtrlCreateLabel ("Current Printer IP:", 15, 102)
$printsiteinput = GUICtrlCreateInput ("", 125, 100, 210)
$printsitelabel1 = GUICtrlCreateLabel ("Input Site Name:", 15, 132)
$printsiteinput1 = GUICtrlCreateInput ("", 125, 130, 210)
GUICtrlCreateGroup("", -99, -99, 1, 1)  ;close group
_HidePrinters ()
$rebootergroup = GUICtrlCreateGroup("Rebooter Setup", 5, 50, 390, 265)
$rebootercombolabel = GUICtrlCreateLabel ("Model of Rebooter", 15, 72)
$rebootercombo = GUICtrlCreateCombo ("", 125, 70, 210)
$rebootercombodata = GUICtrlSetData(-1, "IP9258|NP-02U|","")
$rebootercombolabel0 = GUICtrlCreateLabel ("Rebooter to Configure", 15, 102)
$rebootercombo0 = GUICtrlCreateCombo ("", 125, 100, 210)
$rebootercombodata0 = GUICtrlSetData(-1, "Rebooter 10.10.10.250|Rebooter1 10.10.10.251|Rebooter2 10.10.10.252|Rebooter3 10.10.10.253|Rebooter4 10.10.10.254|","")
$rebootercombolabel1 = GUICtrlCreateLabel ("Input Site Name:", 15, 132)
$rebootercombolabel2 = GUICtrlCreateInput ("", 125, 130, 210)
$rebootercombolabel3 = GUICtrlCreateLabel ("Port 1:", 15, 162)
$rebootercombolabel4 = GUICtrlCreateInput ("", 125, 160, 210)
$rebootercombolabel5 = GUICtrlCreateLabel ("Port 2:", 15, 192)
$rebootercombolabel6 = GUICtrlCreateInput ("", 125, 190, 210)
$rebootercombolabel7 = GUICtrlCreateLabel ("Port 3:", 15, 222)
$rebootercombolabel8 = GUICtrlCreateInput ("", 125, 220, 210)
$rebootercombolabel9 = GUICtrlCreateLabel ("Port 4:", 15, 252)
$rebootercombolabel10 = GUICtrlCreateInput ("", 125, 250, 210)
_HideRebooters()
$routergroup = GUICtrlCreateGroup("Router and Modem Setup", 5, 50, 390, 265)
$routercombolabel = GUICtrlCreateLabel ("Device to Configure", 15, 72)
$routercombo = GUICtrlCreateCombo ("", 125, 70, 210)
$routercombodata = GUICtrlSetData(-1, "|ADSL Routers|Linksys WRT54GL Wireless Router|Linksys WAG54G2 ADSL Router|Linksys WAG120N ADSL Router||Wireless Routers","")   
_HideRouters()
GUISetState (@SW_SHOW)
 
While 1
    $msg = GUIGetMsg()
  
  Select
   Case $msg = $GUI_EVENT_CLOSE
    ExitLoop
  
   Case $msg = $radio1 And BitAND(GUICtrlRead($radio1), $GUI_CHECKED) = $GUI_CHECKED
    
    _HideRouters()
    _HideRebooters()
    _ShowPrinters()
  
  
      
  
      $msg = GUIGetMsg()  
      Select
     Case $msg = $GUI_EVENT_CLOSE
      ExitLoop
     Case $msg = $OK
    
     GUISetState (@SW_LOCK)
     $deviceip = GUICtrlRead ($printcombo, 0)
     $ip = StringTrimLeft ($deviceip, 9)
     $currentip = GUICtrlRead (11, 0)
     $siteid = GUICtrlRead (13, 0)
     MsgBox (4096, "Result", $ip)
    
     ;__HS2170W($ip, $siteid, $currentip, $printname)
    
    
    EndSelect
    
   Case $msg = $radio2 And BitAND(GUICtrlRead($radio2), $GUI_CHECKED) = $GUI_CHECKED
  
    _HideRouters()
    _HidePrinters ()
    _ShowRebooters()
   Case $msg = $radio3 And BitAND(GUICtrlRead($radio3), $GUI_CHECKED) = $GUI_CHECKED
    
    _HidePrinters ()
    _HideRebooters()
    _ShowRouters()
    
   Case $msg = $OK
    
    $res1 = GUICtrlRead ($radio1, 0)
    If $res1 = 1 then
    
     ;MsgBox (4096, "Result", "Printers")
     ;GUISetState (@SW_LOCK)
     $deviceip = GUICtrlRead (9, 0)
     $ip = StringTrimLeft ($deviceip, 9)
     $currentip = GUICtrlRead (11, 0)
     $siteid = GUICtrlRead (13, 0)
     MsgBox (4096, "Result", $ip)
    
     ;__HS2170W($ip, $siteid, $currentip, $printname)
    
    Elseif $res1 > 1 Then
    
     $res1 = GUICtrlRead ($radio2, 0)
     If $res1 = 1 then
    
      ;MsgBox (4096, "Result", "Rebooters")
      ;GUISetState (@SW_LOCK)
      $deviceip = GUICtrlRead (17, 0)
      If $res1 = 1 then
       $read = GUICtrlRead ($routercombo)
       ;MsgBox (4096, "Result", $read)
      
       If $read = "IP9258" Then
        WAG120NINPUTS ()
        GUICtrlSetState($OK, $GUI_HIDE)
        $GO = GUICtrlCreateButton ("GO", 325, 320, 70)
        $buttonchange = 1
      
        Do
         $msg = GUIGetMsg()
         $msg1 = GUICtrlRead ( $radio3 )
         ;MsgBox (4096, "Result", $msg1)
        Until $msg = $GO or $msg1 >1
        Select
         Case $msg = $GUI_EVENT_CLOSE
          ExitLoop
         Case $msg = $GO
        
         GUISetState (@SW_LOCK)
         ;$deviceip = GUICtrlRead (9, 0)
         ;$ip = StringTrimLeft ($deviceip, 9)
         ;$currentip = GUICtrlRead (11, 0)
         ;$siteid = GUICtrlRead (13, 0)
         MsgBox (4096, "Result", "Go Clicked")
        
         ;__HS2170W($ip, $siteid, $currentip, $printname)
        
        
        EndSelect
      
       ElseIf $read = "NP-02U" Then
        WAG120NINPUTS ()
        GUICtrlSetState($OK, $GUI_HIDE)
        $GO = GUICtrlCreateButton ("GO", 325, 320, 70)
        $buttonchange = 1
      
        Do
         $msg = GUIGetMsg()
         $msg1 = GUICtrlRead ( $radio3 )
         ;MsgBox (4096, "Result", $msg1)
        Until $msg = $GO or $msg1 >1
        Select
         Case $msg = $GUI_EVENT_CLOSE
          ExitLoop
         Case $msg = $GO
        
         GUISetState (@SW_LOCK)
         ;$deviceip = GUICtrlRead (9, 0)
         ;$ip = StringTrimLeft ($deviceip, 9)
         ;$currentip = GUICtrlRead (11, 0)
         ;$siteid = GUICtrlRead (13, 0)
         MsgBox (4096, "Result", "Go Clicked")
        
         ;__HS2170W($ip, $siteid, $currentip, $printname)
        
        
        EndSelect
        $ip = StringTrimLeft ($deviceip, 9)
        $siteid = GUICtrlRead (19, 0)
        $port1 = GUICtrlRead (21, 0)
        $port2 = GUICtrlRead (23, 0)
        $port3 = GUICtrlRead (25, 0)
        $port4 = GUICtrlRead (27, 0)
        ;MsgBox (4096, "Result", $port4)
       EndIf
      ;__HSIP9258($ip, $siteid, $port1, $port2, $port3, $port4)
    
    ElseIf $res1 > 1 Then
      
     $res1 = GUICtrlRead ($radio3, 0)
    
     If $res1 = 1 then
      $read = GUICtrlRead ($routercombo)
      ;MsgBox (4096, "Result", $read)
      If $read = "Linksys WAG120N ADSL Router" Then
       WAG120NINPUTS ()
       GUICtrlSetState($OK, $GUI_HIDE)
       $GO = GUICtrlCreateButton ("GO", 325, 320, 70)
       $buttonchange = 1
      
       Do
        $msg = GUIGetMsg()
        $msg1 = GUICtrlRead ( $radio3 )
        ;MsgBox (4096, "Result", $msg1)
       Until $msg = $GO or $msg1 >1
       Select
        Case $msg = $GUI_EVENT_CLOSE
         ExitLoop
        Case $msg = $GO
        
        GUISetState (@SW_LOCK)
        ;$deviceip = GUICtrlRead (9, 0)
        ;$ip = StringTrimLeft ($deviceip, 9)
        ;$currentip = GUICtrlRead (11, 0)
        ;$siteid = GUICtrlRead (13, 0)
        MsgBox (4096, "Result", "Go Clicked")
      
        ;__HS2170W($ip, $siteid, $currentip, $printname)
      
      
       EndSelect
    
      ElseIf $read = "Linksys WRT54GL Wireless Router" Then
       WAG120NINPUTS ()
       GUICtrlSetState($OK, $GUI_HIDE)
       $GO = GUICtrlCreateButton ("GO", 325, 320, 70)
       $buttonchange = 1
      
       Do
        $msg = GUIGetMsg()
        $msg1 = GUICtrlRead ( $radio3 )
        ;MsgBox (4096, "Result", $msg1)
       Until $msg = $GO or $msg1 >1
       Select
        Case $msg = $GUI_EVENT_CLOSE
         ExitLoop
        Case $msg = $GO
        
        GUISetState (@SW_LOCK)
        ;$deviceip = GUICtrlRead (9, 0)
        ;$ip = StringTrimLeft ($deviceip, 9)
        ;$currentip = GUICtrlRead (11, 0)
        ;$siteid = GUICtrlRead (13, 0)
        MsgBox (4096, "Result", "Go Clicked")
      
        ;__HS2170W($ip, $siteid, $currentip, $printname)
      
      
       EndSelect
    
      ElseIf $read = "Linksys WAG54G2 ADSL Router" Then
       WAG120NINPUTS ()
       GUICtrlSetState($OK, $GUI_HIDE)
       $GO = GUICtrlCreateButton ("GO", 325, 320, 70)
       $buttonchange = 1
      
       Do
        $msg = GUIGetMsg()
        $msg1 = GUICtrlRead ( $radio3 )
        ;MsgBox (4096, "Result", $msg1)
       Until $msg = $GO or $msg1 >1
       Select
        Case $msg = $GUI_EVENT_CLOSE
         ExitLoop
        Case $msg = $GO
        
        GUISetState (@SW_LOCK)
        ;$deviceip = GUICtrlRead (9, 0)
        ;$ip = StringTrimLeft ($deviceip, 9)
        ;$currentip = GUICtrlRead (11, 0)
        ;$siteid = GUICtrlRead (13, 0)
        MsgBox (4096, "Result", "Go Clicked")
      
        ;__HS2170W($ip, $siteid, $currentip, $printname)
 
       EndSelect
      EndIf
     EndIf
    EndIf
  EndSelect
Wend
;==============================================================
; Printer Functions
;==============================================================
Func _HidePrinters()
  
   GUICtrlSetState($printgroup, $GUI_HIDE)
   GUICtrlSetState($printcombolabel, $GUI_HIDE)
   GUICtrlSetState($printcombo, $GUI_HIDE)
   GUICtrlSetState($printcombodata, $GUI_HIDE)
   GUICtrlSetState($printsitelabel, $GUI_HIDE)
   GUICtrlSetState($printsiteinput, $GUI_HIDE)
   GUICtrlSetState($printsitelabel1, $GUI_HIDE)
   GUICtrlSetState($printsiteinput1, $GUI_HIDE)
  
EndFunc
Func _ShowPrinters()
  
   GUICtrlSetState($printgroup, $GUI_SHOW)
   GUICtrlSetState($printcombolabel, $GUI_SHOW)
   GUICtrlSetState($printcombo, $GUI_SHOW)
   GUICtrlSetState($printcombodata, $GUI_SHOW)
   GUICtrlSetState($printsitelabel, $GUI_SHOW)
   GUICtrlSetState($printsiteinput, $GUI_SHOW)
   GUICtrlSetState($printsitelabel1, $GUI_SHOW)
   GUICtrlSetState($printsiteinput1, $GUI_SHOW)
    
EndFunc
    
;==============================================================
; Rebooter Functions
;==============================================================
 
Func _HideRebooters()
  
   GUICtrlSetState($rebootergroup, $GUI_HIDE)
   GUICtrlSetState($rebootercombolabel, $GUI_HIDE)
   GUICtrlSetState($rebootercombo, $GUI_HIDE)
   GUICtrlSetState($rebootercombodata, $GUI_HIDE)
   GUICtrlSetState($rebootercombolabel0, $GUI_HIDE)
   GUICtrlSetState($rebootercombo0, $GUI_HIDE)
   GUICtrlSetState($rebootercombodata0, $GUI_HIDE)
   If $IP9258visible = 1 then
    GUICtrlSetState($rebootercombolabel1, $GUI_HIDE)
    GUICtrlSetState($rebootercombolabel2, $GUI_HIDE)
    GUICtrlSetState($rebootercombolabel3, $GUI_HIDE)
    GUICtrlSetState($rebootercombolabel4, $GUI_HIDE)
    GUICtrlSetState($rebootercombolabel5, $GUI_HIDE)
    GUICtrlSetState($rebootercombolabel6, $GUI_HIDE)
    GUICtrlSetState($rebootercombolabel7, $GUI_HIDE)
    GUICtrlSetState($rebootercombolabel8, $GUI_HIDE)
    GUICtrlSetState($rebootercombolabel9, $GUI_HIDE)
    GUICtrlSetState($rebootercombolabel10, $GUI_HIDE)  
   EndIf
  
  
   If $NP02Uvisible = 1 then
    GUICtrlSetState($rebootercombolabel1, $GUI_HIDE)
    GUICtrlSetState($rebootercombolabel2, $GUI_HIDE)
    GUICtrlSetState($rebootercombolabel3, $GUI_HIDE)
    GUICtrlSetState($rebootercombolabel4, $GUI_HIDE)
    GUICtrlSetState($rebootercombolabel5, $GUI_HIDE)
    GUICtrlSetState($rebootercombolabel6, $GUI_HIDE)
   EndIf
  
   If $buttonchange = 1 Then
    _GUICtrlButton_Destroy ($GO)
    GUICtrlSetState($OK, $GUI_SHOW)
   EndIf
  
EndFunc
Func _ShowRebooters()
  
   GUICtrlSetState($rebootergroup, $GUI_SHOW)
   GUICtrlSetState($rebootercombolabel, $GUI_SHOW)
   GUICtrlSetState($rebootercombo, $GUI_SHOW)
   GUICtrlSetState($rebootercombodata, $GUI_SHOW)
   GUICtrlSetState($rebootercombolabel0, $GUI_SHOW)
   GUICtrlSetState($rebootercombo0, $GUI_SHOW)
   GUICtrlSetState($rebootercombodata0, $GUI_SHOW)
  
    
EndFunc
    
Func _ShowIP9256()
  
   GUICtrlSetState($rebootercombolabel1, $GUI_SHOW)
   GUICtrlSetState($rebootercombolabel2, $GUI_SHOW)
   GUICtrlSetState($rebootercombolabel3, $GUI_SHOW)
   GUICtrlSetState($rebootercombolabel4, $GUI_SHOW)
   GUICtrlSetState($rebootercombolabel5, $GUI_SHOW)
   GUICtrlSetState($rebootercombolabel6, $GUI_SHOW)
   GUICtrlSetState($rebootercombolabel7, $GUI_SHOW)
   GUICtrlSetState($rebootercombolabel8, $GUI_SHOW)
   GUICtrlSetState($rebootercombolabel9, $GUI_SHOW)
   GUICtrlSetState($rebootercombolabel10, $GUI_SHOW)
   $IP9258visible = 1
  
EndFunc
 
Func _NP02U()
  
   GUICtrlSetState($rebootercombolabel1, $GUI_SHOW)
   GUICtrlSetState($rebootercombolabel2, $GUI_SHOW)
   GUICtrlSetState($rebootercombolabel3, $GUI_SHOW)
   GUICtrlSetState($rebootercombolabel4, $GUI_SHOW)
   GUICtrlSetState($rebootercombolabel5, $GUI_SHOW)
   GUICtrlSetState($rebootercombolabel6, $GUI_SHOW)
   $NP02Uvisible = 1
  
EndFunc
;==============================================================
; Router Functions
;==============================================================
Func _HideRouters()
  
   GUICtrlSetState($routergroup, $GUI_HIDE)
   GUICtrlSetState($routercombolabel, $GUI_HIDE)
   GUICtrlSetState($routercombo, $GUI_HIDE)
   GUICtrlSetState($routercombodata, $GUI_HIDE)
  
  
  
   ;$visible = $labelvisible
   ;MsgBox (4096, "RESULT!", $visible)
   If $WAG120NVisible = 1 then
    GUICtrlSetState($WAG120NSiteLabel, $GUI_HIDE)
    GUICtrlSetState($WAG120NSiteInput, $GUI_HIDE)
    GUICtrlSetState($WAG120NUserLabel, $GUI_HIDE)
    GUICtrlSetState($WAG120NUserInput, $GUI_HIDE)
    GUICtrlSetState($WAG120NPassLabel, $GUI_HIDE)
    GUICtrlSetState($WAG120NPassInput, $GUI_HIDE)
   EndIf
  
   If $buttonchange = 1 Then
    _GUICtrlButton_Destroy ($GO)
    GUICtrlSetState($OK, $GUI_SHOW)
   EndIf
  
  
EndFunc
Func _ShowRouters()
  
   GUICtrlSetState($routergroup, $GUI_SHOW)
   GUICtrlSetState($routercombolabel, $GUI_SHOW)
   GUICtrlSetState($routercombo, $GUI_SHOW)
   GUICtrlSetState($routercombodata, $GUI_SHOW)
  
EndFunc
 
Func WAG120NINPUTS ()
  
   $WAG120NSiteLabel = GUICtrlCreateLabel ("Input Site Name:", 15, 102)
   $WAG120NSiteInput = GUICtrlCreateInput ("", 125, 100, 210)
   $WAG120NUserLabel = GUICtrlCreateLabel ("User Name:", 15, 133)
   $WAG120NUserInput = GUICtrlCreateInput("@direct.telstra.net", 125, 130, 210)
   $WAG120NPassLabel = GUICtrlCreateLabel ("Password:", 15, 164)
   $WAG120NPassInput = GUICtrlCreateInput("", 125, 160, 210)
   $WAG120NVisible = 1
EndFunc
Edited by hispeed_mike
Link to comment
Share on other sites

I looked at the code and trying to trace which select goes with which endselect, if with endif, while with wend is extremely difficult with the way you have it laid out. But I think the change below will fix it.

;__HS2170W($ip, $siteid, $currentip, $printname)
        EndSelect
       EndIf
      EndIf
     EndIf
    EndIf
   EndIf
 EndSelect
WEnd

This code replaces the code above where you have the comments for Printer Functions starting and from the commented line above. You were missing 2 EndIf statements.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

If you put comments on each of the conditional statements, as to what they're doing, it might make it easier for you to figure out where everything goes. Plus it helps you if forget sometime in the future what you intended that chunk of code to do.

BTW, the way I figured out what the missing end statements were was to find the middle of your code, and start collapsing the folds one at a time. Eventually I found an If with no endif, and then after that was inserted, found the next one.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

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