Problem mit Select Case Anweisung

  • Hi,

    ich habe ein kleines Script geschrieben, und wenn ich das jetzt compilen will kommt folgender Fehler:

    Zitat

    >"C:\Programme\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\test.au3"
    C:\test.au3 (73) : ==> "Case" statement with no matching "Select"or "Switch" statement.:
    Case $msg = $GUI_EVENT_CLOSE
    ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????t
    >Exit code: 1 Time: 0.530

    Das hier ist der Quellcode:

    Was mich dabei wundert ist, das das Script einwandfrei lief, als der Anweisungsblock der ersten Case Anweisung nur 2-3 Zeilen lang war. Kann das an der Länge liegen?

    Gruß Carny

    Einmal editiert, zuletzt von Carny (3. August 2008 um 13:03)

  • Hi,
    dir fehlt ein Endif und in Zeile 60 die ""

    Spoiler anzeigen
    [autoit]


    #include <GUIConstantsEx.au3>
    #include <ProgressConstants.au3>
    #include <WindowsConstants.au3>
    #include <IE.au3>
    #include <String.au3>

    [/autoit] [autoit][/autoit] [autoit]

    $url = String("http://www.test.de/")
    $url1 = String("http://www.test.de")
    $url2 = String("/")
    $go = Int(0)
    $start = Int(0)
    $limit = Int(0)
    $found = Int(0)
    $i = $start
    $source = String("")
    Dim $result[5]

    [/autoit] [autoit][/autoit] [autoit]

    _IEErrorHandlerRegister()

    [/autoit] [autoit][/autoit] [autoit]

    $oIE = _IECreateEmbedded()
    GUICreate("Test", 800, 600, _
    (@DesktopWidth - 800) / 2, (@DesktopHeight - 600) / 2, _
    $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)
    $GUIActiveX = GUICtrlCreateObj($oIE, 10, 40, 780, 510)
    $GUI_Progress = GUICtrlCreateProgress(10, 10, 780, 20, $PBS_SMOOTH)
    $GUI_Button_Start = GUICtrlCreateButton("Start", 10, 560, 100, 30)
    $GUI_Label_Start = GUICtrlCreateLabel("Start:", 120, 562, 100, 30)
    $GUI_Label_Limit = GUICtrlCreateLabel("Limit:", 120, 582, 100, 30)
    $GUI_Label_Aktuell = GUICtrlCreateLabel("Aktuell:", 280, 562, 100, 30)
    $GUI_Label_Fund = GUICtrlCreateLabel("Letzter Fund:", 280, 582, 100, 30)
    $GUI_Label_Aktuell2 = GUICtrlCreateLabel("-", 350, 562, 100, 30)
    $GUI_Label_Fund2 = GUICtrlCreateLabel("-", 350, 582, 100, 30)
    $GUI_Label_Gefunden = GUICtrlCreateLabel("Gefunden:", 400, 562, 100, 30)
    $GUI_Label_Ratio = GUICtrlCreateLabel("Ratio:", 400, 582, 100, 30)
    $GUI_Label_Gefunden2 = GUICtrlCreateLabel("-", 470, 562, 100, 30)
    $GUI_Label_Ratio2 = GUICtrlCreateLabel("-", 470, 582, 100, 30)
    GUICtrlSetState(-1, $GUI_DROPACCEPTED)
    $GUI_Input_Start = GUICtrlCreateInput($start, 150, 560, 100, 20)
    $GUI_Input_Limit = GUICtrlCreateInput($limit, 150, 580, 100, 20)

    [/autoit] [autoit][/autoit] [autoit]

    GUISetState() ;Show GUI

    [/autoit] [autoit][/autoit] [autoit]

    _IENavigate($oIE, $url)

    [/autoit] [autoit][/autoit] [autoit]

    ; Waiting for user to close the window
    While 1
    $msg = GUIGetMsg()
    Select
    Case $msg = 0 ;Dumpen
    If $go = 1 And $i < $limit Then ;Dabei
    GUICtrlSetData($GUI_Label_Aktuell2, $i) ;Aktuell updaten
    If $found > 0 Then GUICtrlSetData($GUI_Label_Ratio2, (($found / ($i - $start)) * 100) & "%") ;Ratio updaten
    _IENavigate($oIE, ($url1 & $i & $url2))
    $source = _IEDocReadHTML($oIE)
    If Not $source = 0 Then
    $result = _StringBetween($source, '.@[@.', "@.''] '.@]@.'")
    If Not @error Then ;Gefunden?
    $file = FileOpen("result.txt", 1)
    If $file = -1 Then
    MsgBox(0, "Error", "Unable to open file.")
    Exit
    EndIf
    FileWriteLine($file, $result[0])
    FileClose($file)
    $found = $found + 1
    GUICtrlSetData($GUI_Label_Fund2, $i) ;Letzter Fund updaten
    GUICtrlSetData($GUI_Label_Gefunden2, $found) ;Gefunden updaten
    EndIf
    GUICtrlSetData($GUI_Progress, Floor(($i / ($limit - $start)) * 100))
    $i = $i + 1
    EndIf
    EndIf
    Case $msg = $GUI_EVENT_CLOSE
    ExitLoop
    Case $msg = $GUI_Button_Start
    If $go = 1 Then
    $go = 0
    GUICtrlSetData($GUI_Button_Start, "Start")
    Else
    $go = 1
    ;Start und Limit setzen
    $start = GUICtrlRead($GUI_Input_Start)
    $limit = GUICtrlRead($GUI_Input_Limit) ;Felder neu setzen? -> Ja
    $i = $start
    $found = 0
    GUICtrlSetData($GUI_Progress, 0)
    GUICtrlSetData($GUI_Button_Start, "Stop")
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    EndSelect
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    GUIDelete()

    [/autoit] [autoit][/autoit] [autoit]

    Exit

    [/autoit]
  • Top danke, meintest du mit Zeile 60 das Stringbetween? Das hat die automatische URL Umwandlung vom Forum iwie durcheinandergebracht, aber das Endif hab ich echt nicht gesehen :)