Name of the Parent script

I have called number of scripts within a script and I want to know the parent script name of the running script.

e.g.:
"C" script called from "B" and "B" called from "A"

if I am in C I want to check the name of the immediate parent (i.e. B in this case) or the complete hierarchy of the calling script (i.e. C>B>A).

How can I do this?

Comments

  • EggplantMattEggplantMatt ForumAdmin admin
    One way of getting the name of the script that called the current script would be to use the following command:
    put  the last item delimited by "/" of the scriptObjectID  of the  penultimate item of the callstack
    
    Similarly you could generate a list of all of the scripts in the callstack with this command:
    put the last item delimited by "/" of the scriptObjectID of each item of the callstack
    
  • SenseTalkDougSenseTalkDoug ForumAdmin admin
    Or if you like, you can save about 10 keystrokes by using the lastPathComponent function instead of the last item delimited by "/":
    put the lastPathComponent of the scriptObjectID of each item of the callstack
    
    :-)
  • User1User1 Member
    Thanks it solved my problem.
Sign In or Register to comment.