Jump to content

EndSwitch problem with AutoIt


Amixg
 Share

Recommended Posts

I would like to create a fairly basic programming language in AutoIt based on an unknown programming language called Vatical. I am at the beginning of this fantastic programming language, and many times I do not understand programming errors, as in this case. I have a problem with a script, when I compile the script I get an error: "EndSwitch statement with no matching switch statement". Still, there is a Switch in the code! Would you help me? Thanks in advance.

 

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Array.au3>

; GUI created by Koda.

$currentfile = ""
$variables = ""             ; All variables of Vatical.

Func ParseIt($filetoparse)
     $sct = ["test"]
     _FileReadToArray($filetoparse, $sct)
     
     For $vt = 0 To UBound($sct)
         If $sct[$vt] <> "" Then
            If StringTrimLeft($sct[$vt], Len($sct($vt))-1) <> "$" Then

               If UpperCase(StringTrimLeft($sct[$vt], Len($sct($vt))-5)) == "PRAY " Then
                  MsgBox(1, StringTrimRight($sct[$vt], 5), "Dialog")

               ElseIf UpperCase(StringTrimLeft($sct[$vt], Len($sct($vt))-4)) == "EXIT" Then
                  MsgBox(1, "Script ended by: istruction", "Script ended: " & @TIME)
                  Exit For
               Else
                  MsgBox("Unrecognized command: " & $sct[$vt], "Error: 3")
               EndIf
            EndIf
         EndIf
     Next
EndFunc


$Form1 = GUICreate("Vatical Language", 469, 128, 206, 123)
$Group1 = GUICtrlCreateGroup("Vatical 4.0", 8, 8, 449, 105)
$Button1 = GUICtrlCreateButton("Select Vatical File", 56, 40, 121, 25)
$Input1 = GUICtrlCreateInput("", 200, 40, 241, 21)
$Button2 = GUICtrlCreateButton("Load Script", 56, 72, 385, 25)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

        Case $Button1
                     $ertt = FileOpenDialog ("Vatical Language Open", ".", "Vatical Files(*.vat) | All Files(*.*)")
                     If @error <> 0 Then
                        GUICtrlSetData($Input1, $ertt)
                        $currentfile = $ertt
                     Else
                        MsgBox(1, "Error: file dont exists in this directory.", "Error: 1")
                        Exit
                     EndIf
        Case $Button2
                     If FileExists($currentfile) And $currentfile <> "" Then
                        ParseIt($currentfile)
                     Else
                        MsgBox(1, "Error: you dont have selected a file.", "Error: 2")
                     End If
                
       EndSwitch
WEnd

 

Link to comment
Share on other sites

  • 2 weeks later...

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