Charles, It's been my habit over all my years of writing code to do complete error checking and reporting of found errors in terms that a human being who is not a programmer can understand, and I'm actually somewhat obsessive about doing that. That means that in code that I write a message such as ISO8601 plugin: D:\ShowTimeNonFailure.btm [6] Invalid time "abc" is not acceptable to me; I don't want to see where the message is coming from ("ISO8601 plugin:"), the name of the .btm file where the error occurred and the line number on which the error occurred (no further comment needed), and I even want to supply the exact error text myself so that it is worded in terms that the user can fully understand (specifically the ultimate source of the data that is in error). Well as far as I can tell the ISO plugin fails on all three counts. Specifically, the .btm file "ShowInvalidTimeProcessingResults.btm":
and the results of executing it:
Note that the "On Error" didn't "catch" the error, the error message was printed despite the redirection of the error stream to null, and, of course, that's really not the message I want the user to see in the first place.
So, two possible ways to fix this:
1. Let the plugin "report" errors in the same manner as TCC does itself in batch files, i.e., the actual error message being redirectable to NUL: or any place of the user's choosing and the error being catchable by an "On Error" statement.
2. If that's not really practical because of the basic underlying architecture of the TCC "plugin" capability (I have no idea whether or not that is the case), alternatively a function could be supplied that can validate times (a similar function for dates would also be useful) either just generically verifying times in either AM/PM format or in 24 hour format, or maybe a parameter that can be used to specify which format is wanted by the user, or even a result of the function that indicates which particular format the time was in if the time was, in fact, valid.
For the short term I'll write my own code to do this, but it would be really nice if the plugin did this for me (and other users).
BTW, just so it doesn't get "lost in the crowd", again the plugin is really wonderful, just not quite perfect yet.
- Dan
Code:
@Echo Off
SetLocal
Set BadTime=abc
@Echo Bad Time: %BadTime
On Error MsgBox /M /S OK Error!!!
@Echo >&NUL: %@TimePlus[%BadTime,0]
EndLocal
Quit 0
Code:
[D:\]ShowInvalidTimeProcessingResults
Bad Time: abc
ISO8601 plugin: D:\ShowInvalidTimeProcessingResults.btm [6] Invalid time "abc"
So, two possible ways to fix this:
1. Let the plugin "report" errors in the same manner as TCC does itself in batch files, i.e., the actual error message being redirectable to NUL: or any place of the user's choosing and the error being catchable by an "On Error" statement.
2. If that's not really practical because of the basic underlying architecture of the TCC "plugin" capability (I have no idea whether or not that is the case), alternatively a function could be supplied that can validate times (a similar function for dates would also be useful) either just generically verifying times in either AM/PM format or in 24 hour format, or maybe a parameter that can be used to specify which format is wanted by the user, or even a result of the function that indicates which particular format the time was in if the time was, in fact, valid.
For the short term I'll write my own code to do this, but it would be really nice if the plugin did this for me (and other users).
BTW, just so it doesn't get "lost in the crowd", again the plugin is really wonderful, just not quite perfect yet.
- Dan