nobbe Posted June 22, 2007 Share Posted June 22, 2007 some may find this useful to invoke a program with multiple parameters CODE;<exefilename> -t test -m lala $ret = _ReadCmdLine("t"); MsgBox(0, "ret", $ret) $ret = _ReadCmdLine("m"); MsgBox(0, "ret", $ret) ; ; read the command line parameters and return value ; ; options are separated by "-" ; Func _ReadCmdLine($switch) If $CmdLine[0] > 0 Then $Cmdopt = StringSplit($CmdLineRaw, "-") ; options are separated by "-" ; _ArrayDisplay($Cmdopt, "options") ; start with 2 For $I = 2 To UBound($Cmdopt) - 1 ; $param = StringLeft($Cmdopt[$I], 1) ; "f" - 1 char ; value is now rest of switch $value = StringRight($Cmdopt[$I], StringLen($Cmdopt[$I]) - 1) ; take rest as value $value = StringStripWS($value, 3); ; found it ?? If $param = $switch And $value <> "" Then Return $value EndIf ; value F? Next ; all params EndIf Return 0; default EndFunc ;==>_ReadCmdLine Link to comment Share on other sites More sharing options...
jvanegmond Posted June 22, 2007 Share Posted June 22, 2007 How about reading all the commands in at once and returning a multidimensional array with the values and their switches. github.com/jvanegmond Link to comment Share on other sites More sharing options...
_Kurt Posted June 22, 2007 Share Posted June 22, 2007 How about reading all the commands in at once and returning a multidimensional array with the values and their switches.Yes, arrays are our friends! They're always easy to deal with Kurt Awaiting Diablo III.. Link to comment Share on other sites More sharing options...
jvanegmond Posted June 22, 2007 Share Posted June 22, 2007 What do you think about having an option like this Kurt: Opt("CmdLineSeperatorChar", " -") github.com/jvanegmond Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now