next week my holiday starts ... and I'd like to create an nice UDF
I would like to create a cli.au3 in Autoit --> for Autoit.
What it is supposed to do?
In Perl or Java there a funcs that deal with the arguments passed by commandline parameters to your code.
Like myExe.exe -i inputFilePath -o outputFilePath -t -s
Till now, it is up to you coding something like this:
If $CmdLine[0] > 0 Then Select $CmdLine[1] Case $CmdLine[1] == "Hello" out("hello") Case $CmdLine[1] == "Test" ConsoleWrite("Test" & @CRLF) Case Else out("unknown Parameter!") EndSelect Else MsgBox(0, "Info", "No parameter --> exit", 4) Exit (0) EndIf Func out($txt) MsgBox(0, "Info", $txt) EndFunc ;==>out
I would like to create some func to make things easier to use, but I need some suggestions before I start.
What funcs are needed?
I thought it would be nice to have something like this:
Func _setVersion($s_version = '-version', $icon = 64, $s_Title = @ScriptName, $s_Message = 'Version : ', $i_timeout = 10)
If one of the parameters is -version then show this MsgBox ...
Func _setHelpMsg($s_help = '-?', $icon = 64, $s_Title = @ScriptName, $s_Message = '', $i_timeout = 10)
If one of the parameters is -help or -? then show this MsgBox ...
Func _setParameter($mandatoryParameter_A, $optionalParameter_A = '')
You can set parameters that have to be passed by otherwise the usage (Msgbox from setHelpMsg) will be shown and script exits.
The func returns an 2D array with parameter[0] and parameterValue[1] e.g:
[0][0] = count of parameters
[1][0] = i
[1][1] = inputFilePath
...
Or a func like getCLIValue('-i') return is inputFilePath and so on.
Addional debug func two parameters (debug and level)
If one of the parameter is -debug then a global variable called $b_Debug = 0 is set to True
and -debuglevel sets the level (like 0=info=much logging, 1=warn=log only warnings, 2=fatal=log only errors)
Questions:
What should happen to parameters passed twice?
What should happen to unexpected parameters?
Should there be an option to set sign to determine parameters like (-,/,--)?
Should there be an sort option?
Thanks for you suggestions.
Questions over all, do you think this can come in handy / be useful?
So long,
Mega





