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

Dec 30, 2010
12
0
#1
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,240
11
Solon, OH, USA
#2
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,240
11
Solon, OH, USA
#5
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$