Welcome!

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

SignUp Now!

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

Dec
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
 
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
 
Can you do that from a command line ... namely, start a BTM file at a particular label?
 
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$
 
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$
Or CALL ... but both lead to nesting.
 

Similar threads

Back
Top