Sign in to follow this  
Followers 0
gamerman2360

CmdLine

2 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

*Tests Func* Works here. Lol, at first I thought there would be tons of "AutoIt Error"s because of all the IFs and FORs(where I usually mess up). Great, now I'm bored again, nothing to script...

Edited by gamerman2360

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  
Followers 0