Kind of a out-of-curiosity question re. the "Function" command...

May 24, 2010
855
0
Northlake, Il
Just as a preface, all of the following is just for illustrative purposes only and not anything close to what I was trying to "accomplish".

Doing this:
Code:
Function MMM=`%1 %2 %3 %4 %5`
and entering this command:
Code:
Echo %@MMM[This Is a Test]
yeilds:
Code:
This Is a Test
pretty much what you would expect.

But doing this:
Code:
Function MMM=`%*`
and entering the same command:
Code:
Echo %@MMM[This Is a Test]
yeilds:
Code:
ECHO is OFF

Why is that?
 
May 24, 2010
855
0
Northlake, Il
Actually, Charles, no; although it really wouldn't make any practical difference in this case. "%$" is "the complete command tail, modified by SHIFT", whereas "%*" is "the complete command tail, unmodified by SHIFT", and since I am not (never will) be doing any "SHIFT" commands in this "application", it really doesn't matter in this case. (And frankly, that being the case, I have a slight bias for "%*"', I use "%$" only when I am explicitly doing shifts.)

- Dan

P. S. Thank you, Charles!!! You were correct!!!! I just did that "experiment" after originally hitting the "Save Changes" button on this; I thought "Just for the heck of let's see what this does...", and it does exactly what I would want it do. But do you know why "%*" doesn't work???
 
May 24, 2010
855
0
Northlake, Il
You are, of course, right as always, David. (My inability to see is, as oft mentioned before, a real handicap.) However, they not only do they not behave the way I would expect from the documentation, the "results" can actually be far worse (more on that at the bottom of this). So, to "illustrate" these things, here is a TCC "log".
Code:
   Sat  Dec 17, 2011  11:45:40p

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:\]Function XPer=`%$`

[Z:\]Echo %@XPer[First 2ndParm Third 4th Fifth 6th Seventh]
First 2ndParm Third 4th Fifth 6th Seventh

[Z:\]Function XPer=`%*`

[Z:\]Echo %@XPer[First 2ndParm Third 4th Fifth 6th Seventh]
ECHO is OFF

[Z:\]Function XPer=`%3$`

[Z:\]Echo %@XPer[First 2ndParm Third 4th Fifth 6th Seventh]
Third 4th Fifth 6th Seventh

[Z:\]Function XPer=`%-3$`

[Z:\]Echo %@XPer[First 2ndParm Third 4th Fifth 6th Seventh]
2ndParm

So, from the documentation:

The parameter %-n$ means "the arguments from parameter 1 to n - 1".

However, the first parameter ("First"), is not being printed.

Code:
[Z:\]Function XPer=`%-2$`

[Z:\]Echo %@XPer[First 2ndParm Third 4th Fifth 6th Seventh]
ECHO is OFF

Again, the first parameter is not being printed (kind of obviously, I would say).

Code:
[Z:\]Function XPer=`%-1$`

[Z:\]Echo %@XPer[First 2ndParm Third 4th Fifth 6th Seventh]

And here is the end of the whole thing, because at this point TCC just crashed. (Since I knew it was going to crash from a previous run-through, I saved this to a file before I issued the above command.)

What's kind of remarkable to me is that nobody (apparently even you) has "noticed" this behavior before.

- Dan
 
Similar threads
Thread starter Title Forum Replies Date
M Not real important but kind of annoying EXIT issue... Support 20
M Not really a problem; just kind of a question... Support 0
R Curiosity - can TCC be a VBA Add-In? Support 2
vefatica A help curiosity Support 1
M A just out of curiosity question re @DiskTotal Support 4
M A just-out-of-curiosity question because it's ... Support 6
M Just an out-of-curiosity question re. "Do ... /P ..." Support 31
M Just an out-of-curiosity question the List command vs. the @Lines function... Support 13
M A question about file compression that is just out of curiosity... Support 2
M A purely out-of-curiosity question about @DriveType and @DriveTypeEx Support 2
M Question about the "Start" command that is admittedly not too important and just out of curiosity... Support 1
M Just a curiosity question related to the "Function" command... Support 2
J assoc curiosity Support 1
C forum Posting Question... Support 3
C question re: Move Support 3
S How to? Upgrade Question: What supporting documentation is required at time of purchase? Support 2
Peter Murschall Documentation Question to %@PSHELL Support 4
Fross Tab Question Support 6
Fross Quick Function Question Support 17
Dick Johnson Question about the Touch command Support 0
rps Documentation "Copy+Paste+run" question Support 2
vefatica SFTP question Support 17
vefatica Question about IPWorks Support 0
C How to? SHORTCUT question..... Support 6
vefatica TPIPE, crash and question Support 1
C Question / Suggestion Support 1
MickeyF Another TPIPE question Support 6
vefatica Another @EVERYTHING question Support 4
mikea How to? %@everything[] question Support 10
A License Question for Single User Support 5
Jay Sage Help Correction (and Related Question) Support 0
S Elapsed time in TCC prompt question Support 0
H command line parsing question Support 5
C Forum question Support 2
B Newbie here, I have a question. Support 4
J Dumb Question ... Support 4
Timothy Byrd Updating from TC 9 to TC 17 - TCTOOLBAR question Support 2
M A possibly stupid question about the "del" command... Support 7
Fross Status Bar Time Question Support 1
A Stupid, obvious question - launch a BAT with TC Support 10
C How to? GLOBAL question Support 5
vefatica OT: VisualStudio question Support 1
vefatica Wildcard question Support 4
Dan Glynhampton v15 installer question Support 2
C Move question with Encrypted file... Support 6
M Maybe Maybe I'm being stupid (again), but a simple question... Support 4
C Message Board question Support 1
James Miller How to? filename completion question Support 1
C coding question Support 3
Frank question to FOLDERMONITOR Support 14

Similar threads