douglas.swehla wrote:I'd like to understand better exactly what you're trying to accomplish, and in what context.
Thanks for the interesting questions. Basically, this thread is an attempt to figure out if a unified efficient approach is possible to decipher and verify various user inputs, entered:
a) as arguments when calling a batch manually or from a Task Scheduler
b) when the batch just started and may require additional typed input if some data missing in startup arguments
c) when various sections of the batch are executed
All input verification is ideally performed in a unified manner requiring minimal total batch code, and maximum re-use of more or less universal verification function(s).
Some folks post enormous size batches on this forum, where most of the code is devoted to verifying user input in a repetitive manner. While these batches may be easier for others to modify, they aren't necessarily represent the best approach to batch programming. A lot shorter code can do the same tasks faster, and with enough clarity for a trained user. In that regard we were trying to figure out above, what set of arguments is sufficient to perform the task, and how "missing" pieces can be derived from existing ones (i.e. by extracting substrings, delaying or disabling variable expansion, using related arguments, etc). The less arguments are entered for each, the more flexible but longer verification function code is.
As to answering your questions, the above are just code snippets, not necessarily representing any particular batch used in practice, but rather designed to reflect possible approaches to a generic solution.
Answers:
A. Yes for the snippet
B. It depends on each variable, hence the need for several verification options (i.e. validation methods)
C. Snippet with possibility of custom messages posted
hereD. Using various ring tones is shown
hereE. Yes
F. An integrated verification function is preferred
G. Yes, depending on completeness of the initial set of arguments entered when calling the batch
H. If startup arguments are incomplete for the tasks or erroneous, gathering more input may be required down the road, including when performing required batch tasks
How entered variables are used - they're printed to screen in the above snippet.
Can you give some examples how is it important for the verification task? Did you mean they can be verified at application stage by checking the outcome? Possibly, but usually resulting in a longer code and unneeded iterations compare to verifying variables at entering. If you want to show a practical method implementing similar or your own approach to significantly shorten code, re-design of this
FrameTool.bat, which also
has a "lower half", may be an interesting though challenging starting point.