I previously submitted this with no real resolution that I could find in this forum and just “left it alone” because it did have a fairly simple workaround (namely testing the return from "@Index" for "LT 0" rather than "== -1"). But the simple fact is that the @Index function is returning a value that it, put simply, should absolutely never, according to the documentation, ever, return under any circumstances whatsoever, specifically the number “-7”, and I can’t help but think that Rex might want to fix it. Now I will add, as almost a side comment, that this is even stranger than I would have possibly imagined before doing the "research" I needed to do to submit this posting!
Specifically, the the Error.btm file contains the following code (this is a "straight" copy with no "modifications of any kind whatsoever):
This is one run and its output (which is completely "sensible"):
This is another run, and its output, and I will note in advance to save you some time in trying to figure out exactly what the difference(s) are, is that this time I am invoking it with two parameters (the second one being the word "junk"), but if you look at the above code, you will see that the parameter "%2" is never even referenced, not as "itself" and not as the result of a "Shift" command.
I don’t think there’s much else to say here, although I am including a "zipped" copy of the exact same .btm file that I am running above so anyone else can check it out to their heart's content, so to speak, although I absolutely will not be surprised if they do not get the same results that I am getting!! I wil also note here that at this time the "full" .btm file that this code was extracted from is doing absolutely nothing but "parsing" an input parameter, but I really don't see the relevance of that fact given that the above and attached code is giving me the results that it is.
TCC 12.11.73 Windows 7 [Version 6.1.7601]
Specifically, the the Error.btm file contains the following code (this is a "straight" copy with no "modifications of any kind whatsoever):
Code:
@Echo Off
SetLocal
Set ArchivePathName=%@UnQuote[%1]
Gosub CheckDrive %ArchivePathName
EndLocal
Quit 0
:CheckDrive [PathToBeChecked]
@Echo On
@Echo PathToBeChecked: %PathToBeChecked
@Echo Set I=@Index[%PathToBeChecked,:,-1]
Set I=%@Index[%PathToBeChecked,:,-1]
@Echo I: %I
If %I LT 0 Return 4
Return 0
Code:
[Z:\]Error ThisIsATest.7z
PathToBeChecked: ThisIsATest.7z
Set I=@Index[ThisIsATest.7z,:,-1]
Set I=-1
I: -1
If %I LT 0 Return 4
EndLocal
Quit 0
Code:
[Z:\]Error ThisIsATest.7z junk
PathToBeChecked: ThisIsATest.7z
Set I=@Index[ThisIsATest.7z,:,-1]
Set I=-7
I: -7
If %I LT 0 Return 4
EndLocal
Quit 0
TCC 12.11.73 Windows 7 [Version 6.1.7601]