Dear Pegasus:
First, thank you for replying.
"Msgbox wscript.fullname" will return the fullname (path + name + ext) of
the script in which the "Msgbox wscript.fullname" line resides.
wscript.fullname won't port the fullname info from TriggerScriptA.vbs to
ActionScript.vbs, unless an "argument methodology" (to coin a term) is
employed by both scripts (one script sending the argument via command line,
and the other script using the usual code for harvesting arguments [For Each
strArgument in Wscript.Arguments; a = strArgument; Next]).
I bet that there is some memory register/registry/location/thingamajig,
where the calling program temporarily records its name and the name of the
target program, but I speak so confidently only because I speak from abject
ignorance.
My guess is that vbscript doesn't readily provide access to such info, even
if such info exists, and is available thru some other program (e.g., vb.net,
powershell etc).
Marc
--
MarceepooNu
"Pegasus [MVP]" wrote:
>
>
> "MarceepooNu" <mbh2010@newsgroup> wrote in message
> news:743FF7A5-8729-411D-838D-B8808BA2A8CB@newsgroup
> > I would like to code a vbscript ("ActionScript.vbs") in such a way that it
> > would do X, if ActionScript.vbs were called by "TriggerScriptA.vbs", but
> > do
> > something else if ActionScript.vbs were called by "TriggerScriptAB.vbs".
> >
> > Is there some way by which ActionScript.vbs could identify the
> > program/process that called ActionScript.vbs?
> >
> > If the answer is "yes", that would be useful in many contexts.
> >
> > For example, it would be useful in the context of Hta programming, where
> > (I
> > think) a button (that calls a vbscript inside the Hta file) cannot send
> > arguments to the vbscript sub that the button calls. Thus, each button
> > has
> > to have its own sub. As my Hta files grow in size, the proliferation of
> > subs
> > makes it more difficult to keep track of them, and I worry about ram or
> > resource usage being wasted.
> >
> > By contrast, if a sub (that opens a shell and calls exe files) could
> > "smell"
> > which button called the sub, I'd need only one sub (that opens a shell and
> > calls exe files) and it could have a nice alphabetically sorted set of
> > Case
> > Selects, that would call the right exe files.
> >
> > Identifying the process would be useful in other contexts too. I have a
> > growing library of backup scripts that backup files and folders at various
> > times. I would like the script to be able to know when it was called by
> > another script, as distinguished from being called by me double clicking
> > on
> > the vbscript in Windows explorer.
> >
> >
> > Thanks,
> >
> > Marc >
> Perhaps the property wscript.FullName?
>
> .
>