"bWaitOnReturn" option for WshShell.Run method 
Author Message
 "bWaitOnReturn" option for WshShell.Run method

I am attempting to use the WshShell.Run method to run a ScriptIT routine
that clicks the OK button in a dialog produced by WinFax. However, I
want the ScriptIT process to await the arrival of the dialog box (when a
new fax arrives and is printed). Using the WshShell.Run method instead
spawns a new ScriptIT process each minute (because I have the wsf file
run each minute to check for the presence of the dialog box).

I would like the Run method to exercise the "bWaitOnReturn" option that
seems to be available, according to the on-line documentation. I get an
erro message instead (which I can't repeat at the moment, because I am
away from the computer in question--I will reproduce it when I return to
that machine, now that I understand how to use a news group).

Simple question: Does anyone know whether the bWaitOnReturn option
actually works?

Completely along another path, is there a utility that would trigger the
"OK" or "enter" dialog that I'm trying to automate? ScriptIT is the only
approach I've found.

Many thanks in advance.

Tom Herlihy



Wed, 14 May 2003 03:00:00 GMT  
 "bWaitOnReturn" option for WshShell.Run method

Quote:

> Simple question: Does anyone know whether the bWaitOnReturn option
> actually works?

Yes, bWaitOnReturn does work as long as the process you are waiting on doesn't spawn another process
and then terminate.

Quote:

> Completely along another path, is there a utility that would trigger the
> "OK" or "enter" dialog that I'm trying to automate? ScriptIT is the only
> approach I've found.

ScriptIT is probably as good a choice as any other (WSH doesn't natively support this itself).

--
Michael Harris
Microsoft.MVP.Scripting
--

Please do not email questions - post them to the newsgroup...
--



Wed, 14 May 2003 03:00:00 GMT  
 "bWaitOnReturn" option for WshShell.Run method
Michael:

Many thanks--this newsgroup is a good resource!!

TWH

Quote:

> > Simple question: Does anyone know whether the bWaitOnReturn option
> > actually works?

> Yes, bWaitOnReturn does work as long as the process you are waiting on doesn't spawn another process
> and then terminate.

> > Completely along another path, is there a utility that would trigger the
> > "OK" or "enter" dialog that I'm trying to automate? ScriptIT is the only
> > approach I've found.

> ScriptIT is probably as good a choice as any other (WSH doesn't natively support this itself).

> --
> Michael Harris
> Microsoft.MVP.Scripting
> --

> Please do not email questions - post them to the newsgroup...
> --



Thu, 15 May 2003 03:00:00 GMT  
 "bWaitOnReturn" option for WshShell.Run method
As a follow on, taking up Michael's point, what, if anything, can be done if
the process DOES spawn another process then self terminate. Is there a way
of tracking which processes are spawned by other processes. If this is the
case, it should be possible to write code which watches an initial process,
and waits until both it, and any child processes (and children thereof) have
also terminated! The more I think about it, the more it scares me!

This is not just an academic question, as I have a genuine use for this.

Opinions/answers please!


Quote:
> Michael:

> Many thanks--this newsgroup is a good resource!!

> TWH


> > > Simple question: Does anyone know whether the bWaitOnReturn option
> > > actually works?

> > Yes, bWaitOnReturn does work as long as the process you are waiting on

doesn't spawn another process
Quote:
> > and then terminate.

> > > Completely along another path, is there a utility that would trigger
the
> > > "OK" or "enter" dialog that I'm trying to automate? ScriptIT is the
only
> > > approach I've found.

> > ScriptIT is probably as good a choice as any other (WSH doesn't natively

support this itself).
Quote:

> > --
> > Michael Harris
> > Microsoft.MVP.Scripting
> > --

> > Please do not email questions - post them to the newsgroup...
> > --



Thu, 15 May 2003 03:00:00 GMT  
 "bWaitOnReturn" option for WshShell.Run method

"...Is there a way of tracking which processes are spawned by other processes. ..."

If you know that foo.exe will spawn an instance of bar.exe, you *could* use WMI it track the PIDs
(Process IDs) of instances of bar.exe.  For example, before executing foo.exe, record the PIDs (if
any) of bar.exe instances.  Execute foo.exe and recheck the PIDs for bar.exe instances.  The one
that is new is for the new instance of bar.exe spawned by foo.exe.  There might even be a more
direct way using WMI notification events but that would take a lot more time to research ;-)...

I don't know if there is a generic technique available to script clients to track the child
processes of an arbitrary parent process.  If there is one it would probably involve WMI...

--
Michael Harris
Microsoft.MVP.Scripting
--

Please do not email questions - post them to the newsgroup instead.
--

Quote:

> As a follow on, taking up Michael's point, what, if anything, can be done if
> the process DOES spawn another process then self terminate. Is there a way
> of tracking which processes are spawned by other processes. If this is the
> case, it should be possible to write code which watches an initial process,
> and waits until both it, and any child processes (and children thereof) have
> also terminated! The more I think about it, the more it scares me!

> This is not just an academic question, as I have a genuine use for this.

> Opinions/answers please!



> > Michael:

> > Many thanks--this newsgroup is a good resource!!

> > TWH


> > > > Simple question: Does anyone know whether the bWaitOnReturn option
> > > > actually works?

> > > Yes, bWaitOnReturn does work as long as the process you are waiting on
> doesn't spawn another process
> > > and then terminate.

> > > > Completely along another path, is there a utility that would trigger
> the
> > > > "OK" or "enter" dialog that I'm trying to automate? ScriptIT is the
> only
> > > > approach I've found.

> > > ScriptIT is probably as good a choice as any other (WSH doesn't natively
> support this itself).

> > > --
> > > Michael Harris
> > > Microsoft.MVP.Scripting
> > > --

> > > Please do not email questions - post them to the newsgroup...
> > > --



Fri, 16 May 2003 03:00:00 GMT  
 "bWaitOnReturn" option for WshShell.Run method
hi Andrew,

While tracking prosess creation/termination sounds more sophisticated, there
is always the "Brute Force" approach...

What does your secondary process do???  Does it change a registry entry.
Does it write a file???  Presumably it does SOMETHING!

Then (instead of some nifty bWaitOnReturn), you could wait for a file to be
created (or changed), some registry entry to be changed, or whatever.  That
is, unless you have an app that does nothing and leaves no trace of itself
ever running...

cheers, jw


Quote:
> As a follow on, taking up Michael's point, what, if anything, can be done
if
> the process DOES spawn another process then self terminate. Is there a way
> of tracking which processes are spawned by other processes. If this is the
> case, it should be possible to write code which watches an initial
process,
> and waits until both it, and any child processes (and children thereof)
have
> also terminated! The more I think about it, the more it scares me!

> This is not just an academic question, as I have a genuine use for this.

> Opinions/answers please!



> > Michael:

> > Many thanks--this newsgroup is a good resource!!

> > TWH


> > > > Simple question: Does anyone know whether the bWaitOnReturn option
> > > > actually works?

> > > Yes, bWaitOnReturn does work as long as the process you are waiting on
> doesn't spawn another process
> > > and then terminate.

> > > > Completely along another path, is there a utility that would trigger
> the
> > > > "OK" or "enter" dialog that I'm trying to automate? ScriptIT is the
> only
> > > > approach I've found.

> > > ScriptIT is probably as good a choice as any other (WSH doesn't
natively
> support this itself).

> > > --
> > > Michael Harris
> > > Microsoft.MVP.Scripting
> > > --

> > > Please do not email questions - post them to the newsgroup...
> > > --



Fri, 16 May 2003 03:00:00 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Using variables in WshShell.Run ("....")

2. WshShell.Run "path with spaces" fails

3. "Run" method to launch IE

4. JavaScript "\"" and WShell Run

5. Set WSHShell = WScript.CreateObject("WScript.Shell")

6. Set WshShell = CreateObject("WScript.Shell")

7. wshshell.run "rundll.exe wsock32.dll, ...

8. Detect IE "Internet Options"

9. IE3.0 and "Option"

10. unknown option specified "-"

11. createElement("OPTION") help

12. How to place "_target" option

 

 
Powered by phpBB® Forum Software