Sorry I haven't gotten back to this for a couple of days; it's simply because I've been truly overwhelmed (actually, nothing at all out of the ordinary for me given the glacial pace at which I manage to actually accomplish anything), and the simple fact is that it is really questionable whether doing this is the top "priority" in my list of probably 40 to 50 things (sadly, neither a joke nor an exaggeration!!!) I have to accomplish the sooner the better. But, for whatever reason, this is at the top of my priorities as of this moment.
And Charles, the first and most important thing I want to accomplish (there are sometimes a few things that are logically similar to "end of file" but you get a "hard" error rather than a "nice" "end of file-"like indication) is to have a .btm file to
both terminate when an error occurs (as an example, sometimes continuing can be very "damaging" because the batch file continues to do things (like delete files that it really shouldn't delete but is deleting as a "side effect" of the error)
and the fact that I put an error-handler into the batch file I can longer see what the error(s) actually was(/were). For me, a
very bad "catch-22".
So it's like this:
Here's a simple .BTM file named "IllustrateErrorHandling":
Code:
@Echo Off
Set RC=0
If "%1" == "RC" On Error Set RC=8
If "%1" == "MSG" On Error Goto HaveError
ANonExistentCommand
AnotherNonExistentCommand
@Echo RC: %RC
Quit
:HaveError
@Echo **** %@ERRTEXT[%_SYSERROR]
Quit
And here's a really about as simple as it possibly could be .BTM file named "EchoArgument.btm":
Here are the results(s) of running ""IllustrateErrorHandling" all three possible ways, as well as the effective, but mostly silent, almost total "destruction" (if you want to know exactly what I mean by that word, read further) of the TCC session in which the command is executed:
Wed Dec 21, 2011 12:44:35p
ISO8601 plugin v1.1.1 loaded.
SafeChars plugin v1.5.7 loaded.
TCC 12.11.76 Windows 7 [Version 6.1.7601]
Copyright 2011 Rex Conn & JP Software Inc. All Rights Reserved
Registered to Daniel Mathews
[Z:\]EchoArgument Argument
Argument
[Z:\]IllustrateErrorHandling
TCC: Z:\IllustrateErrorHandling.btm [5] Unknown command "ANonExistentCommand"
TCC: Z:\IllustrateErrorHandling.btm [6] Unknown command "AnotherNonExistentCommand
"
RC: 0
[Z:\]EchoArgument Argument
Argument
[Z:\]IllustrateErrorHandling RC
RC: 8
[Z:\]EchoArgument Argument
Argument
So, to start, everything is working OK up to this point.
[Z:\]IllustrateErrorHandling MSG
^C
Notice that the "" .BTM file just "hung" in the last "step" in the above, and I had to hit Ctrl-C to "get out of it. But after that, the "execution engine" for batch files was completely "broken", as none of the below attempted batch file executions did anything at all:
[Z:\]IllustrateErrorHandling
[Z:\]IllustrateErrorHandling RC
[Z:\]IllustrateErrorHandling MSG
[Z:\]IllustrateErrorHandling RC
[Z:\]EchoArgument Argument
Again note that absolutely none of the above "commands" (i.e., executing ".btm" files) did absolutely anything at all. However, I will note that it is "limited" to only batch files:
[Z:\]Echo Internal commands still work...
Internal commands still work...
[Z:\]notepad "A Sample Text File.txt"
This only "sort of" worked in that, while Notepad
did "start up", the TCC session
totally "hung" until the Notepad program was "closed" (ala the "Start" command with the "/WAIT" option).
However, since I have a very high reliance on (many!) batch files that are essentially "crutches" of one kind or another for my disabilities, this effectively makes that TCC session totally useless for me.
And to give you some idea of how many "many" is in terms of the number of batch files that I have "under development" is that number is
40 (yes, I have a hard time believing that number myself!). But there's actually
175 .btm files on my RAM disk as of this second; "40" is gotten by subtracting the number of .btm files with "Test" as the first 4 letters of their names (30 of them) because the are batch files that were purely created to test other batch files, the number of .btm files with the "Exper" as the first 4 characters of the name (38 of them), the character string ".V2011-" in its name (14 of them) because when I start a new "version" of a batch file based on a "previous" version that is mostly working), and those with whose names are "*-#" or "*+#" (40 of them, where "#" represents an arbitrary "number") because these are either "back" versions of a .btm file that I really don't intend to keep (except for "reference purposes" for a limited period of time, the negative numbers) or purely experimental "new" versions where I have not yet decided to "follow the path" that the "experiment" suggests (the positive numbers), or whose names "end" with a Roman Numeral (12 of them; I don't name files that way all that often). (And
all of these numbers are actually accurate thanks to a large degree to the "wonders" of TCC! I've attached a file listing all of these files to this posting if you are curious and want to look at it because you don't quite believe me.)
And, one final "odd" thing that I haven't been able to consistently repeat up to now: Sometimes typing the "Exit" command "works" and usually ends the TCC session, but sometimes it does not and I have to close the TCC session by "hitting" the "close" button (little "x" on the top right of the tab) to close the TCC session. Admittedly, this is only a minor annoyance for me, but, while I used to be an exceptionally fast typist before my disabilities got the "better of me", I'm still a fairly fast typist now, but having to use the mouse (actually the touch pad on this laptop) is a pain in the rear for me, to put it "nicely". I can probably go for literally hours with out ever touching the touch pad or a touch pad button.
And if this a problem that can't be fixed (I have to admit I really don't understand that as a person who at least used to be a very good programmer, Rex - why are the details of the errors/error messages no longer available when you go into a error handler? A purely rhetorical question...), this truly is a very big problem for me because of the multitude of errors I make on an almost-continual basis; I swear, I can write two lines of code and have 10 errors!!! But I truly have no other viable choice but to use TCC because these problems are significantly "enhanced" in C++ programs, primarily because of the typically vastly larger amount of code has to be written (more code, more chances for error and therefore more errors) to get much of anything done and the fact that executing arbitrary TCC commands in batch files (ala "@ExecStr" and "@ExecArray") is another large pain in the the rear, to put it politely).
And something I may or may not have said before (I wouldn't necessarily remember): Because of the severity two of my two most severe disabilities (
extremely bad memory and a total inability to write - as in a pen or pencil and paper), to say I would probably have to be institutionalized as of this minute were it not for this computer
and Take Command and TCC would be a considerable understatement. So thank you again, Rex!
- Dan