Weird @Index function result...

May 24, 2010
855
0
Northlake, Il
Here is the code in question:
Code:
Set FullFileName=%@Trim[%@Right[-53,%Line]]
Set M=%@Index[%FullFileName,\,-1]
@Echo FullFileName: %FullFileName
@Echo Index: %@Index[%FullFileName,\,-1]   M: %M
Here is the output of the above code:
Code:
FullFileName: Fact.txt
Index: -24   M: -24
The question is obvious: what is going on here?
 
May 20, 2008
603
0
Sammamish, WA
FullFileName: Fact.txt
Index: -1 M: -1
I get results that are expected, but I did prepend one line to simulate your
input.

set Line=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaFact.txt

You do not mention what %Line contains. Perhaps there's something causing
trouble in the original input. Does it have special characters (e.g.
backspace)? I still can't come up with a reason for -24.

TCC 12.11.73 x64 Windows 7 [Version 6.1.7600]
TCC Build 73 Windows 7 Build 7600

On Thu, Aug 11, 2011 at 15:13, mathewsdw <> wrote:


> Here is the code in question:
>
> Code:
> ---------
> Set FullFileName=%@Trim[%@Right[-53,%Line]]
> Set M=%@Index[%FullFileName,\,-1]
> @Echo FullFileName: %FullFileName
> @Echo Index: %@Index[%FullFileName,\,-1] M: %M
> ---------
> Here is the output of the above code:
> Code:
> ---------
> FullFileName: Fact.txt
> Index: -24 M: -24
> ---------
> The question is obvious: what is going on here?
>
>
>
>
>



--
Jim Cook
2011 Monday: 4/4, 6/6, 8/8, 10/10, 12/12 and 5/9, 9/5, 7/11, 11/7.
Next year they're Tuesday.
 
May 24, 2010
855
0
Northlake, Il
FullFileName: Fact.txt
Index: -1 M: -1
I get results that are expected, but I did prepend one line to simulate your
input.

set Line=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaFact.txt

You do not mention what %Line contains. Perhaps there's something causing
trouble in the original input. Does it have special characters (e.g.
backspace)? I still can't come up with a reason for -24.

TCC 12.11.73 x64 Windows 7 [Version 6.1.7600]
TCC Build 73 Windows 7 Build 7600

On Thu, Aug 11, 2011 at 15:13, mathewsdw <> wrote:
--
Jim Cook
2011 Monday: 4/4, 6/6, 8/8, 10/10, 12/12 and 5/9, 9/5, 7/11, 11/7.
Next year they're Tuesday.
Jim, I modified the batch file slightly:
Code:
Set FullFileName=%@Trim[%@Right[-53,%Line]]
Set M=%@Index[%FullFileName,\,-1]
@Echo Line: "%Line"
@Echo FullFileName: %FullFileName
@Echo Index: %@Index[%FullFileName,\,-1]   M: %M
Here's the new output:
Code:
Line: "2011-07-03 17:35:36 ....A     13862737      4626295  Fact.txt"
FullFileName: Fact.txt
Index: -24   I: -24
(Note that the line is being printed out enclosed in double quotes.) And the line being parsed does not, as far as I know, contain any non-printable characters (and there's no reason why it would). Doesn't really seem to explain anything.
 
May 20, 2008
603
0
Sammamish, WA
I'm still getting desirable results. Any chance that @index has been changed
by a user function? I don't have good ideas, I'm afraid.

On Thu, Aug 11, 2011 at 19:44, mathewsdw <> wrote:


> ---Quote (Originally by Jim Cook)---
> FullFileName: Fact.txt
> Index: -1 M: -1
> I get results that are expected, but I did prepend one line to simulate
> your
> input.
>
> set Line=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaFact.txt
>
> You do not mention what %Line contains. Perhaps there's something causing
> trouble in the original input. Does it have special characters (e.g.
> backspace)? I still can't come up with a reason for -24.
>
> TCC 12.11.73 x64 Windows 7 [Version 6.1.7600]
> TCC Build 73 Windows 7 Build 7600
>
> On Thu, Aug 11, 2011 at 15:13, mathewsdw <> wrote:
> --
> Jim Cook
> 2011 Monday: 4/4, 6/6, 8/8, 10/10, 12/12 and 5/9, 9/5, 7/11, 11/7.
> Next year they're Tuesday.
> ---End Quote---
> Jim, I modified the batch file slightly:
>
> Code:
> ---------
> Set FullFileName=%@Trim[%@Right[-53,%Line]]
> Set M=%@Index[%FullFileName,\,-1]
> @Echo Line: "%Line"
> @Echo FullFileName: %FullFileName
> @Echo Index: %@Index[%FullFileName,\,-1] M: %M
> ---------
> Here's the new output:
>
> Code:
> ---------
> Line: "2011-07-03 17:35:36 ....A 13862737 4626295 Fact.txt"
> FullFileName: Fact.txt
> Index: -24 I: -24
> ---------
> (Note that the line is being printed out enclosed in double quotes.) And
> the line being parsed does not, as far as I know, contain any non-printable
> characters (and there's no reason why it would). Doesn't really seem to
> explain anything.
>
>
>
>
>



--
Jim Cook
2011 Monday: 4/4, 6/6, 8/8, 10/10, 12/12 and 5/9, 9/5, 7/11, 11/7.
Next year they're Tuesday.
 
May 24, 2010
855
0
Northlake, Il
I'm still getting desirable results. Any chance that @index has been changed
by a user function? I don't have good ideas, I'm afraid.
--
Jim Cook
2011 Monday: 4/4, 6/6, 8/8, 10/10, 12/12 and 5/9, 9/5, 7/11, 11/7.
Next year they're Tuesday.
Jim, I would say not only "no", but "absolutely not"! This is because, among several other things, this same instance of the"@Index" function does work in this batch file most of the time! (And the workaround that seems to work for the moment is to replace "Iff %@Index[...] == -1 Then" by "Iff %@Index[...] LT 0 Then".
 
May 20, 2008
603
0
Sammamish, WA
On Thu, Aug 11, 2011 at 21:42, rconn <> wrote:


> ---Quote---
> > Code:
> > ---------
> > FullFileName: Fact.txt
> > Index: -24 M: -24
> > ---------
> > The question is obvious: what is going on here?
> ---End Quote---
> I can't begin to guess (and certainly can't begin debugging) without
> knowing
> what %LINE contains.
>

I believe a later post in this same thread said it contained this, without
quotes:

"2011-07-03 17:35:36 ....A 13862737 4626295 Fact.txt"

Using that, I still can not find any trouble.



>
> Rex Conn
> JP Software
>
>
>
>
>



--
Jim Cook
2011 Monday: 4/4, 6/6, 8/8, 10/10, 12/12 and 5/9, 9/5, 7/11, 11/7.
Next year they're Tuesday.
 
May 24, 2010
855
0
Northlake, Il
I can't begin to guess (and certainly can't begin debugging) without knowing
what %LINE contains.

Rex Conn
JP Software
Rex,

You didn't see the previous where I answered this question for Jim Cook. Here is the relevant part of that reply:
Code:
Set FullFileName=%@Trim[%@Right[-53,%Line]]
Set M=%@Index[%FullFileName,\,-1]
@Echo Line: "%Line"
@Echo FullFileName: %FullFileName
@Echo Index: %@Index[%FullFileName,\,-1]   M: %M
Here's the new output:
Code:
Line: "2011-07-03 17:35:36 ....A     13862737      4626295  Fact.txt"
FullFileName: Fact.txt
Index: -24   I: -24
(Note that the line is being printed out enclosed in double quotes.) And the line being parsed does not, as far as I know, contain any non-printable characters (and there's no reason why it would).

And Rex, I would be perfectly OK with sending you the whole .btm file as well as its input file if that is what you would like. I'm having another really weird error, also, that I'm putting that in another post, so that might be a good idea.
 
Similar threads
Thread starter Title Forum Replies Date
Dick Johnson Weird Color Problem Support 8
vefatica BEEP - weird on two machines Support 8
JohnQSmith Weird DIR output (missing lines) Support 1
samintz WAD Weird REN bug Support 6
M WAD Another weird copy command errror... Support 2
D WAD Multiple TEE causese weird variable scoping? Support 7
S Weird tab completion in command line Support 2
dcantor Weird interaction with Task Scheduler Support 5
J weird issues in TC10.00.55 Support 4
D Help index has GUNZIP Support 0
C WAD @index not working in v16 x64 Support 14
S Documentation HELP Nit - Index - Desktop command Support 0
M @Index not working like I thought it would... Support 2
Phileosophos How to? The help system redirects to the index page Support 4
M "Reawakening" of an @Index issue... Support 8
M echo %@index[1234,.,-1] return -21 in new version Support 3
C jpsoft.com/oldver/index Support 1
S Index entry Support 0
vefatica No help index entry for WINDOW Support 4
vefatica Documentation Function parameters Support 0
Jay Sage Documentation Function @DRIVE Missing in Help Lists Support 0
Joe Caverly How to? Get name of current LIBRARY function? Support 4
x13 WeekNum function? Support 3
Joe Caverly No blank line in TEXT...ENDTEXT in a LIBRARY function Support 8
cgunhouse Ctrl-C from within a library function Support 6
C email[string] function Support 10
R FUNCTION to count NUMBER of files matching a pattern and specific length/not length Support 4
Dick Johnson Using the @instr function Support 5
vefatica '}' in a library function? Support 3
D Can the argument to RETURN be a function expansion? Support 3
J Trouble with @full[] function. Support 3
Fross Quick Function Question Support 17
vefatica Quoting @Function parameters? Support 0
Joe Caverly Debugging a LIBRARY function Support 10
Steve Pitts Documentation @CAPI function summary Support 0
x13 %x$ in function Support 3
thorntonpg @eval function, interesting results any explanation? Support 3
x13 Function to get interface user-defined name? Support 10
vefatica Fixed Help @FUNCTION, missing paragraph Support 8
Mordachai Variable followed by function constantly failing... Support 5
nickles Call a complex function Support 13
M Fixed Cannot use the "Browse..." function in "Find files/text" dialogbox Support 2
R Function #IDOW returns only 2 characters Support 10
T scrput `` in alias or function Support 2
S International characters - TYPE vs %@LINE function Support 5
JohnQSmith WAD @REPEAT function Support 15
vefatica WAD Nested variable expansion in PDIR's @function[*]? Support 13
R In addition to ALIAS /Z and FUNCTION /Z, HISTORY /Z? Support 1
A pdir function usage Support 3
nikbackm FUNCTION with variable number of arguments Support 17

Similar threads