Another "What is wrong?"

May 24, 2010
855
0
Northlake, Il
Behold the following:
Code:
TCC: Z:\BuildFlatSongNames.btm [24]  Variable loop
Z:\BuildFlatSongNames.btm [24]  Usage : IF [/I] [NOT] condition [.AND. | .OR. | .XOR. [NOT] condition ...] command
And the line(s) in question:
Code:
23  If NOT EXIST "F:\Full\%BaseName; %Artist; %@Field["\",-1,%Name].%@Ext[%Name]" ^
24     MkLink /H "F:\Full\%BaseName; %Artist; %@Field["\",-1,%Name].%@Ext[%Name]" %Song
If there's something wrong there (and I am assuming that there is) I'm certainly not seeing it.
 
May 20, 2009
293
5
57
ITALY
Behold the following:
Code:
TCC: Z:\BuildFlatSongNames.btm [24]  Variable loop
Z:\BuildFlatSongNames.btm [24]  Usage : IF [/I] [NOT] condition [.AND. | .OR. | .XOR. [NOT] condition ...] command
And the line(s) in question:
Code:
23  If NOT EXIST "F:\Full\%BaseName; %Artist; %@Field["\",-1,%Name].%@Ext[%Name]" ^
24     MkLink /H "F:\Full\%BaseName; %Artist; %@Field["\",-1,%Name].%@Ext[%Name]" %Song
If there's something wrong there (and I am assuming that there is) I'm certainly not seeing it.

You might want to check the exact values of these variables.
If it is inside a loop, just for test, You might add lines such as "echo BaseName = %BaseName" and then a "pause" command.
Also, if %Name is the complete name of a file (You use %@Ext[%Name] to get the extension), then I believe that to get the base name You should use %@Field["\",-0,%Name] and not %@Field["\",-1,%Name].
But, I am not sure, I do not know what are the values of these variables.


Regards

Rodolfo Giovanninetti
 

rconn

Administrator
Staff member
May 14, 2008
12,340
149
Behold the following:
Code:
TCC: Z:\BuildFlatSongNames.btm [24]  Variable loop
Z:\BuildFlatSongNames.btm [24]  Usage : IF [/I] [NOT] condition [.AND. | .OR. | .XOR. [NOT] condition ...] command

TCC returns the variable loop error message when you have variables defined inside variables. The variable expansion parser will go 15 levels deep trying to (recursively) expand a variable name, but if you have something like variable a contains variable b which contains variable a, you'll get the loop error.
 
May 24, 2010
855
0
Northlake, Il
First a note. I asked initially asked this question quite a while ago but I got involved in other tasks and just got back to it today.

Rex, I understood that. However I don't see any way I have a variable name inside of a variable. Here's the whole BTM file:
Code:
  1 @Echo Off
  2 SetLocal
  3 For /R F:\Music %FileName in (*) Do (
  4  Gosub DoIt "%FileName"
  5 )
  6 EndLocal
  7 Quit 0
  8 :DoIt [Song]
  9  Set Name=%@Unquote[%Song]
  10  Set BaseName=%@Name[%Song]
  11  If %@IsDigit[%@Left[2,%BaseName]] == 1 .AND. "%@Instr[3,3.%BaseName]" == " - " ^
  12  Set BaseName=%@Right[-5,%BaseName] (%@Left[2,%BaseName])
  13  Iff "%@Field["\",-1,%Name]" == "Disc " Then
  14  Set Artist=%@Field["\",-3,%Name]
  15  If "%@Right[5,%Artist]" == ", The" ^
  16  Set Artist=The %@Left[-5,%Artist]
  17  If NOT EXIST "F:\Full\%BaseName; %Artist; %@Field["\",-2,%Name].%@Ext[%Name]" ^
  18  Echo MkLink /H "F:\Full\%BaseName; %Artist; %@Field["\",-2,%Name].%@Ext[%Name]" %Song
  19  Else
  20  Set Artist=%@Field["\",-2,%Name]
  21  If "%@Right[5,%Artist]" == ", The" ^
  22  Set Artist=The %@Left[-5,%Artist]
  23  If NOT EXIST "F:\Full\%BaseName; %Artist; %@Field["\",-1,%Name].%@Ext[%Name]" ^
  24  Echo MkLink /H "F:\Full\%BaseName; %Artist; %@Field["\",-1,%Name].%@Ext[%Name]" %Song
  25  EndIff
  26 Return
I will note that line 24 (the line that is reported as being in error) is in the command that is executed if the condition evaluates to "True". but I will add that that might be just a result of the "If" command spanning two lines.
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
4,448
88
Albuquerque, NM
prospero.unm.edu
As Rodolfo suggests, it would be a good idea to echo the values of critical variables -- in particular %NAME and %BASENAME -- to figure out which file is causing this error.

I wouldn't be surprised if the filename in question contains percent signs. That's not uncommon in files downloaded from the internet with a browser.
 
May 29, 2008
567
4
Groton, CT
This line
Code:
  11  If %@IsDigit[%@Left[2,%BaseName]] == 1 .AND. "%@Instr[3,3.%BaseName]" == " - " ^
looks wrong to me. There should be a comma instead of a period after the second '3' in @instr.
 
May 24, 2010
855
0
Northlake, Il
Thank you Dave, you hit the problem on the nose! That should have been a comma instead of a period. Bad typing made the error; bad eyesight made it hard for me to see it. However that doesn't explain either the error message or the line that was said to be in error, but it's all water under the bridge now.
 
Similar threads
Thread starter Title Forum Replies Date
jdanielp Cannot step into and/or call another .bat file when debugging .bat file Support 2
vefatica Another popup problem Support 10
S How to? Runs start /w in invisible mode OR run program after exit of another one Support 3
G Press on another Window Support 24
M Another possibly strange remote registry issue Support 5
vefatica Another problem with build 22. Support 3
Patulus Yet another thread on CMD compatibility Support 16
M Take Command 18, migrating to another machine, license problem. Support 1
MickeyF Another TPIPE question Support 6
vefatica Another installer thingy Support 1
vefatica Another @EVERYTHING question Support 4
C Touch command — I Need to touch matching files in another directory. Support 5
Bill de Haan Another installation is in progress Support 6
fishman@panix.com Another Problem with The Installer Support 1
Charles Dye Another modest proposal Support 4
Dan Glynhampton Documentation v15 help: Another mailto: link oddity Support 0
M WAD Another weird copy command errror... Support 2
M Yet another strange something re something called "@TCONVERT" Support 8
Charles Dye Documentation Another help nit Support 3
K_Meinhard Documentation Another installer nit Support 1
ehab aboudaya How to? change ALT-F6 to another key Support 1
A How to? Pass output from ffind to another command in a BTM file Support 5
M Another simple question re. Take Command/TCC window witdth in characters... Support 16
Q TCC: (Sys) The process cannot access the file because it is being used by another process. Support 0
M Another bit of weirdness.... Support 0
S MOVE from FTP directory to another FTP directory - bug?? Support 2
vefatica Another debugger observation Support 12
vefatica Another DO /L question Support 1
M Another TCMD "crash" situation... Support 2
S Need help to execute TCC commands on another system Support 6
B TCC doesn't run using another user Support 2
H Another multiple FTP password prompt issue Support 2
Peter Bratton Another little bug? Support 1
M Another problem with renaming files... Support 3
nikbackm Another HISTORY dialog issue Support 0
vefatica Another help nit Support 12
S Another 4NT 8.02 vs TCC 9.02 diff - MOVE command Support 3
p.f.moore Running another batch file without CALL Support 7
JohnQSmith New online help file wrong logo Support 7
vefatica @EXECSTR ... TCSTART ... something's wrong! Support 7
R History window wrong size, can't remember size change Support 12
mfarah Fixed The DATE command produces the wrong error message. Support 1
MikeBaas @regsetenv complains "wrong parameter" Support 14
mikea How to? TCC registered to wrong 'entity' Support 5
T @replace -- what is wrong here Support 2
vefatica Fixed KEYSTACK /i with repeat count sends wrong keys Support 7
C ZIP/U compares wrong timestamp Support 13
vefatica @WORDS, often wrong Support 0
vefatica gcd() ... wrong answer, lcm() hangs Support 5
D What is wrong with this code? Support 7

Similar threads