From: MarceepooNu on 17 Mar 2010 00:14 Thank you for your comment, your insight, and your humor. Your points are well taken. marc p.s. I'm constantly amazed (i.e., annoyed) at the number of sloppy errors I make. -- MarceepooNu "Al Dunbar" wrote: > > > "MarceepooNu" <mbh2010(a)aol.com> wrote in message > news:624CCA11-C7CD-48D6-BBAD-1B58C90BC07D(a)microsoft.com... > > I agree. One of the reasons for my inquiry is the fact that I developed > > many > > scripts before it occurred to me that it might be useful to make a habit > > of > > always including such an argument in the calling script. > > > > The daunting prospect of having to revise every single script led to me > > wonder if there wasn't some easier way of getting the info, > > But, in order for your many scripts to be able to use whatever technique you > were able to develop, wouldn't that be another daunting, script revising, > prospect itself? > > > and of verifying > > the argument, in case somehow the calling script sends the wrong info > > (presumably due to inadvertent sloppy coding on my part). > > If you could write script code that could detect logical errors on the part > of your code, then you are probably a sophisticated enough scripter to be > unlikely to make such sloppy errors. ;-) > > /Al > > > > > marc > > -- > > MarceepooNu > > > > > > "Todd Vargo" wrote: > > > >> MarceepooNu wrote: > >> >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. > >> > >> Basically, your query boils down to: > >> How to determine if a script was double clicked or run by another script? > >> > >> The author of a script has the option to provide an argument when calling > >> another script. Double clicking runs a script without arguments, so if > >> you > >> have the Trigger scripts provide their name as an argument when calling > >> the > >> ActionScript, the ActionScript could use the Wscript.Arguments object to > >> see > >> which TriggerScript, if any, was used. > >> > >> -- > >> Todd Vargo > >> (Post questions to group only. Remove "z" to email personal messages) > >> > >> . > >>
First
|
Prev
|
Pages: 1 2 Prev: How to tell if a contact object exists? Next: Loop to find files, copy and renaming... |