Welcome!

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

SignUp Now!

Tab from clipboard

Aug
1,915
68
Code:
     _x64: 1
   _admin: 1
_elevated: 1

TCC  25.00.20 x64   Windows 10 [Version 10.0.18362.356]

I have a text file, with every second line indented with a tab.

When the array is loaded from a text file, and the elements are echoed, all is well.
That is, the tabs are echoed to the screen.

When the array is loaded from the clipboard, and the elements are echoed, all is not well.
That is, the tabs are not echoed to the screen, nor anything following the tab.

Is this WAD?

Joe

Code:
@echo off
::
:: Display lines 466 to 477 of notes.txt
::
tail /n14 notes.txt | head /n12
echo %@repeat[*,25]
::
::This works as it should
::  Input is from a text file
::
setarray /F aNotes[500]
echo Array has %@filearray[aNotes,notes.txt] elements.
do Element=466 to 477
  echo %aNotes[%Element]
enddo
echo %@repeat[*,25]
::
::Put the file on the clipboard
::
type notes.txt > clip:
::
::
::This does not work as it should
::  Input is from the clipboard
::
setarray /F aNotes[500]
echo Array has %@filearray[aNotes,clip:] elements.
do Element=466 to 477
  echo %aNotes[%Element]
enddo
echo %@repeat[*,25]
quit

Partial Hex dump of notes.txt
Code:
0000 36f0 32 30 31 39 2d 31 31 2d  30 31 20 31 36 3a 30 30  2019-11-01 16:00
0000 3700 3a 33 36 2e 30 36 3a 0d  0a 09 32 32 38 6d 62 0d  :36.06:...228mb.
0000 3710 0a 32 30 31 39 2d 31 31  2d 30 31 20 31 37 3a 30  .2019-11-01 17:0
0000 3720 30 3a 34 39 2e 32 35 3a  0d 0a 09 33 32 31 6d 62  0:49.25:...321mb
0000 3730 0d 0a 32 30 31 39 2d 31  31 2d 30 31 20 31 38 3a  ..2019-11-01 18:
0000 3740 30 33 3a 35 39 2e 39 39  3a 0d 0a 09 33 33 38 6d  03:59.99:...338m
0000 3750 62 0d 0a 32 30 31 39 2d  31 31 2d 30 31 20 32 31  b..2019-11-01 21
0000 3760 3a 30 35 3a 34 37 2e 39  36 3a 0d 0a 09 33 39 37  :05:47.96:...397
0000 3770 6d 62 0d 0a 32 30 31 39  2d 31 31 2d 30 32 20 20  mb..2019-11-02
0000 3780 39 3a 33 30 3a 30 30 2e  36 38 3a 0d 0a 09 35 35  9:30:00.68:...55
0000 3790 33 6d 62 0d 0a 32 30 31  39 2d 31 31 2d 31 34 20  3mb..2019-11-14
0000 37a0 20 38 3a 32 34 3a 34 34  2e 34 36 3a 0d 0a 09 32   8:24:44.46:...2

Output of test3.btm
Code:
e:\utils>test3.btm
2019-11-01 16:00:36.06:
        228mb
2019-11-01 17:00:49.25:
        321mb
2019-11-01 18:03:59.99:
        338mb
2019-11-01 21:05:47.96:
        397mb
2019-11-02  9:30:00.68:
        553mb
2019-11-14  8:24:44.46:
        201.65 62
*************************
Array has 480 elements.
2019-11-01 16:00:36.06:
        228mb
2019-11-01 17:00:49.25:
        321mb
2019-11-01 18:03:59.99:
        338mb
2019-11-01 21:05:47.96:
        397mb
2019-11-02  9:30:00.68:
        553mb
2019-11-14  8:24:44.46:
        201.65 62
*************************
Array has 481 elements.
ECHO is OFF
2019-11-01 16:00:36.06:
ECHO is OFF
2019-11-01 17:00:49.25:
ECHO is OFF
2019-11-01 18:03:59.99:
ECHO is OFF
2019-11-01 21:05:47.96:
ECHO is OFF
2019-11-02  9:30:00.68:
ECHO is OFF
2019-11-14  8:24:44.46:
*************************
 
A quick test; I'll look more after dinner.
Code:
v:\> echo abc^r^n^tdef > clip:

v:\> type clip:
abc
        def

v:\> setarray b[3]

v:\> echo %@execarray[b,type clip:]
0

v:\> echo %b[0]
abc

v:\> echo %b[1]
        def

v:\>
 
Hmmm! I see what you mean. @FILEARRAY and clip: don't seem to get along.

Code:
d:\tc25> echo %@lines[clip:]
1

d:\tc25> type clip:
abc
        def

d:\tc25> setarray /f b[3]

d:\tc25> echo %@filearray[b,clip:] & REM but there are only 2 lines in clip:
3

d:\tc25> do i=0 to 2 ( echo %b[%i] )
ECHO is OFF
abc
ECHO is OFF
 
This works;
Code:
::echo Array has %@filearray[aNotes,clip:] elements.
echo %@execarray[aNotes,type clip:]
echo Array has %_execarray elements.

Thus, it would appear that if a file in the clipboard has tabs embedded, @filearray will not work with it, @execarray will.

Might want to note this in the help file.

Joe
 
I don't think the tabs have anything to do with it.
Code:
v:\> echo abc^r^ndef^r^nghi > clip:

v:\> echo %@lines[clip:]
2

v:\> type clip:
abc
def
ghi

v:\> setarray /f b[4]

v:\> echo %@filearray[b,clip:]
4

v:\> do i=0 to 3 ( echo %b[%i] )
ECHO is OFF
abc
ECHO is OFF
ghi
 
Not directly related, but if you really need to use CLIP:, you could use @CLIP[%element] instead of using an array.
 

Similar threads

Back
Top