Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Weird @Index function result...

May
855
0
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?
 
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.
 
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.
 
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.
 
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".
 
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.
 
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.
 
Back
Top
[FOX] Ultimate Translator
Translate