Page 1 of 1

Get info about calling script

Posted: 09 Jan 2013 23:05
by PeterH
A thing that could make my life (OK: my scripting) easyer would be a function (or XY-variables) that gives me info for the "calling script", like the self-function does for the current script.
That is: I'd need at least "file" and "caption" of the calling script, i.e. the script that called/loaded the current script.

Would that be possible?

(I hope it doesn't exist already - found nothing.)

Other currently availabe info about trigger of current script is <get "trigger">
- but as I said: I find nothing about the calling script.

Re: Get info about calling script

Posted: 10 Jan 2013 17:35
by admin
Undocumented. next beta:

echo caller("caption");
echo caller("File");

etc. ... analog to self.

Re: Get info about calling script

Posted: 10 Jan 2013 19:37
by klownboy
Hey PeterH, I'm curious, have any ideas or examples on how we might use the "caption" or "file" of calling script(s). Do you plan on a different execution, or go to a different "sub", or menu dependent on which script does the calling? Thanks,
Ken

Re: Get info about calling script

Posted: 10 Jan 2013 23:40
by PeterH
admin wrote:Undocumented. next beta:

echo caller("caption");
echo caller("File");

etc. ... analog to self.
:shock: :shock: :shock: :biggrin: :biggrin: :appl: :appl: :appl:

He's done it :biggrin: :biggrin:
(At least I wouldn't have expected it so fast :D )
Thanks a lot, again!

Sometimes I just have a bit of problems with those undocumented functions.
Sometimes ist's hard enough to find a documented function. (If you know what you might want, but not what it's name...)
Undocumented functions everybody has to note for his own. And if you should loose one: it's lost for you :cry:

Don't get me wrong: better undocumented than nothing 8)
But I just don't know if it makes sense to make it undocumented...
klownboy wrote:Hey PeterH, I'm curious, have any ideas or examples on how we might use the "caption" or "file" of calling script(s). Do you plan on a different execution, or go to a different "sub", or menu dependent on which script does the calling? Thanks,
Ken
Sure: I'm playing with some test for a set of routines to create something like a log for script execution. You call routines for start & end of a script, and call one to supply logic information from the script (i.e. when/how to make decisions, loops, etc) - this should help in debugging scripts.
Here it helps very much if the debug-scripts have the ability to see from where (script & caption) they were called.

All this is quite hard, as we can't call scripts with parameters. On one side I try to help for this with permanent vars. And on the other side it can help if the called script is able to get info about it's caller.

In the moment all is in a kind of testing level. If - in the end - I will like it I might publish it here.
But there are a lot of difficulties by the missing ability of paramenters, and the missing ability to explicitely share variables between a routine and called code (maybe name it %include% or such). The result is that the code "doesn't look very nice", and it's still not really easy to use. So I must try some more time to see if it makes sense or not...

Re: Get info about calling script

Posted: 11 Jan 2013 09:14
by admin
I know, but documentation is also work and takes time (and sometimes coding is faster than documenting it). I have thousands of things on my table all the time so I have to make decisions.