Jump to content
Sign in to follow this  
sandman

Else works, but ElseIf doesn't?

Recommended Posts

sandman

I was designing a pretty simple test script that would understand a commandline entry, maybe to show a concept later on for the RAP project.

Anyway, everything worked fine until the part labeled ";THIS PART". Some of the things that are commented were removed to see if they were the problem, but they weren't.

The problem is that when I press the "Execute Command" button when the line containing ";THIS PART" uses an ElseIf command, nothing happens.

; StringBetween Test for commandline functions in RAP

#include <String.au3>
#include <GUIConstants.au3>

$win = GUICreate("CMDLine Test", 454, 48, 193, 115)
$commandline = GUICtrlCreateInput("", 10, 10, 301, 25)
$execute = GUICtrlCreateButton("Execute Command", 330, 10, 105, 25, 0)
GUISetState(@SW_SHOW)

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit
        Case $msg = $execute
            $read = GUICtrlRead($commandline)
            If $read = "" Then
                MsgBox(0, "Uh-oh!", "The command line is blank!!!")
            Else    ;If StringLen($read) > 0 Then
                $command = _StringBetween($read, "/", "\")
;~              StringStripWS($command, 8)
                If $command = 0 Then
                    MsgBox(0, "Uh-oh!", "Bad syntax.")
                ElseIf $command = "query" Then                                                   ;THIS PART!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
                    MsgBox(0, "", "works")
                    $querycomputer = _StringBetween($read, "\", ":")
                    If $querycomputer = 0 Then
                        MsgBox(0, "Uh-oh!", "Bad syntax.")
                    Else
                        If $querycomputer = "self" Then
                            ;read the specific query commands.. will do this later :)
                            MsgBox(0, "ds", "IT WORKS")
                        ElseIf $querycomputer = "ip" Then
                            ;read IP and then specifics
                        ElseIf $querycomputer = "name" Then
                            ;read name and then specifics
                        EndIf
                    EndIf
                EndIf
            EndIf
    EndSelect
WEnd

;small test
;~ $string = "/query\me"
;~ $stringbetween = _StringBetween($string, "/", "\")
;~ MsgBox(0, "CMDLine Function test", $stringbetween[0])

A messagebox does appear when the line with ";THIS PART" uses a plain Else, but not when I put in "ElseIf $command = 'query'".

By the way, I am entering in the input box "/query\self:" to test this.

Thanks,

SANDMAN!


[center]"Yes, [our app] runs on Windows as well as Linux, but if you had a Picasso painting, would you put it in the bathroom?" -BitchX.com (IRC client)"I would change the world, but they won't give me the source code." -Unknownsite . blog . portfolio . claimidcode.is.poetry();[/center]

Share this post


Link to post
Share on other sites
MHz

Case $msg = $execute
            $read = GUICtrlRead($commandline)
            If $read = "" Then
                MsgBox(0, "Uh-oh!", "The command line is blank!!!")
            Else    ;If StringLen($read) > 0 Then
                $command = _StringBetween($read, "/", "\")
;~              StringStripWS($command, 8)
                If $command = 0 ThenoÝ÷ Ø    ²Æ yº1mÚ³öÚ¦¯^Ø^)ÞÂ+aªê-Lr

:shocked:

Edit:

Added a few words to read easier

Edited by MHz

Share this post


Link to post
Share on other sites
sandman

Yay! It works.. thank you!


[center]"Yes, [our app] runs on Windows as well as Linux, but if you had a Picasso painting, would you put it in the bathroom?" -BitchX.com (IRC client)"I would change the world, but they won't give me the source code." -Unknownsite . blog . portfolio . claimidcode.is.poetry();[/center]

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.