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.
Get info about calling script
-
admin
- Site Admin
- Posts: 64836
- Joined: 22 May 2004 16:48
- Location: Win8.1, Win10, Win11, all @100%
- Contact:
Re: Get info about calling script
Undocumented. next beta:
echo caller("caption");
echo caller("File");
etc. ... analog to self.
echo caller("caption");
echo caller("File");
etc. ... analog to self.
FAQ | XY News RSS | XY X
-
klownboy
- Posts: 4397
- Joined: 28 Feb 2012 19:27
- Location: Windows 11, 25H2 Build 26200.7171 at 100% 2560x1440
Re: Get info about calling script
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
Ken
-
PeterH
- Posts: 2826
- Joined: 21 Nov 2005 20:39
- Location: DE W11Pro 24H2, 1920*1200*100% 3840*2160*150%
Re: Get info about calling script
admin wrote:Undocumented. next beta:
echo caller("caption");
echo caller("File");
etc. ... analog to self.
He's done it
(At least I wouldn't have expected it so fast
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
Don't get me wrong: better undocumented than nothing
But I just don't know if it makes sense to make it undocumented...
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.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
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...
-
admin
- Site Admin
- Posts: 64836
- Joined: 22 May 2004 16:48
- Location: Win8.1, Win10, Win11, all @100%
- Contact:
Re: Get info about calling script
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.
FAQ | XY News RSS | XY X
XYplorer Beta Club