Jump to content

CmdLine


gamerman2360
 Share

Recommended Posts

I hope this works... It's not tested so...

;===============================================================================
;
; Description:      Searches for a string from the CmdLine array.
; Syntax:           _SearchCmdLine( "string" )
; Parameter(s):     search - A string to look for in the $CmdLine array.
; Requirement(s):   None
; Return Value(s):  If Found - Returns 1
;                   If Not Found - Returns 0
;                   If found with an "=" sign - Returns the other side of the "=" sign
;                   If found with more than one "=" - Returns the entire mess :)
;                   If found more than once - returns what it usually would with the last parameter
; Author(s):        Steve B
; Note(s):          None
;
;===============================================================================
Func _SearchCmdLine($cmd)
    $flag = 0
    For $i = 1 To $CmdLine[0]
        If StringInStr($CmdLine[$i], $cmd) <> 0 Then
            If StringInStr($CmdLine[$i], "=") <> 0 Then
                $array = StringSplit($CmdLine[$i], "=")
                If $array[0] > 2 Then
                    For $j = 1 To $array[0]
                        If $array[$j] == $cmd Then
                            $flag = $CmdLine[$i]
                            ContinueLoop
                        EndIf
                    Next
                    ContinueLoop
                EndIf
                If $array[1] == $cmd Then
                    $flag = $array[2]
                ElseIf $array[2] == $cmd Then
                    $flag = $array[1]
                EndIf
            Else
                If $CmdLine[$i] == $cmd Then $flag = 1
            EndIf
        EndIf
    Next
    Return $flag
EndFunc
Good luck, B). Edited by gamerman2360
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...