OK, I can't find how to do this, but I know you wizards will...

Dec 30, 2010
13
0
If from script1.btm I do this command:
gosub "script2.btm" Label1

and Script2 internally needs to know "what script just called my Subroutine "label1", how can script2 tell?

Is there some way to access the "stack" of called scripts or some variable or function so I can determine that script1.btm called me?

Thanks in advance,
Peniel02
 

samintz

Scott Mintz
May 20, 2008
1,503
16
Solon, OH, USA
There is no built in way to do it. You would have to code it.

file1.btm:
Code:
gosub "file2.btm" Sub1 %_batchname

file2.btm:
Code:
:Sub1 [caller]
echo This is %_batchname and I was called from %caller
return
 

samintz

Scott Mintz
May 20, 2008
1,503
16
Solon, OH, USA
I imagine a simple batch file could work for that.
Invoke.btm:
Code:
iff %# LT 2 then
  echo usage: Invoke "file" label [args]
  quit
endiff
gosub %1 %2 %3$
 
Similar threads
Thread starter Title Forum Replies Date
J ffind does not find files Support 4
Alpengreis List command: text truncated in find box (german) Support 9
R FIND command error Support 9
vefatica Find Files/Text dialog: does it work? Support 0
T FFind - can we display n number of lines after the find? Support 2
R How to? Find a specific file in subfolders Support 11
Patulus TCHistoryLog: TCC: (Sys) The system cannot find the path specified Support 15
D unzip fails to find valid license Support 3
R Find in screen buffer - find next behavior Support 0
thedave Problem chaining piped FIND commands in BTM Support 7
D CD doesn't always find everything Support 8
B Fixed FFIND doesn't find last character in file without CR/LF at EOF Support 1
M Fixed Cannot use the "Browse..." function in "Find files/text" dialogbox Support 2
vefatica FFIND /S, find directory with specified name? Support 7
D Why doesn't ffind find directory? Support 3
nikbackm How to? Find duplicate lines in text file Support 0
noahcoad WAD cmd.exe under tcc doesn't find apps Support 4
S How to? Find installer downloaded by "option /u"? Support 11
M How to? Find out the total allocated size of a directory tree... Support 7
G Find files but ignore file extension in search Support 2
S CDD Doesn't Find Directory? Support 3
L File association: System cannot find the associated program Support 30
R How to use ffind to find older files? Support 9
Charles Dye Edit / Find dialog Support 0
J Find Files - changing folder Support 1
BobK Error from START cmd, "cannot find the file" Support 16
D ACTIVATE doesn't find windows Support 7
R A problem using find in list when word wrap? Support 2
nikbackm Find out when a process has stopped Support 5
J Find failure dialog box failure Support 0
J Problem with Find dialog Support 3
J Problem with %var:find=replace% syntax Support 5
S LIST and F for find Support 4
M TCC cannot find the path specified Support 4
M TCC Can't find WScript.exe where it says it is Support 0

Similar threads